有没有一种方法可以在没有VPC的情况下将静态IP分配给AWS Lambda? [英] Is there a way to assign a Static IP to a AWS Lambda without VPC?

查看:119
本文介绍了有没有一种方法可以在没有VPC的情况下将静态IP分配给AWS Lambda?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为通过API网关调用的Lambda分配一个静态IP.这是必需的,因为我从此lambda调用的下游系统仅接受来自列入白名单的IP的Web请求.

I am looking to assign a static IP to my Lambda which is being invoked via the API gateway. This is required because, the downstream system that i invoke from this lambda accepts web requests only from a Whitelisted IP.

我通过与我的lambda相关联的VPC成功实现了这一目标.但是VPC引入了不好的冷启动时间,有时范围为12-16秒.因此,我正在寻找一种防止VPC冷启动的方法,但同时要为lambda分配一个静态IP.

I am successful in achieving this via the VPC that i associate with my lambda. But VPC introduces a bad cold-start time which sometime ranges 12-16seconds. So i am looking for a way to prevent this cold start from the VPC, but at the same time assign a static IP to the lambda.

推荐答案

我同意John的回答,其中包含静态IP白名单部分.但是,它不能解决您的冷启动问题,因为lambda(如果理想)实际上需要花费很少的时间来启动.因此,我建议您还创建一个Cloudwatch事件来定期打入lambda来解决此问题,或者编写一个简单的代码(在lambda或其他地方),该代码会定期发送空请求,以便解决冷启动问题.您可以查看X射线中的改进.这是一个开销,但是需要一次的过程.

I agree with the answer by John for having static IP whitelisting part. However, it won't resolve your cold start problem because lambda,if ideal, actually takes a small time to start. So I would recommend you also create a Cloudwatch event to hit lambda periodically to resolve this or write a simple code(either in lambda or somewhere else) which sends an empty request periodically so that cold start problem is resolved. You can view the improvement in X-Ray. This is an overhead but one time process.

这篇关于有没有一种方法可以在没有VPC的情况下将静态IP分配给AWS Lambda?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆