简体   繁体   中英

AWS alternative for Lambda in VPC

Currently, I use AWS Lambda as backend behind AWS API Gateway with lambda proxy integration. Since my lambda function needs to have access to VPC resources, the lambda functions is in a VPC. Unfortunately, lambda in VPC has extreme long cold start times (sometimes more than 10 seconds). Therefore, I want to use alternatives for my lambda scripts which are written in python. One alternative I thought about is to use elastic beanstalk with a python flask application and integrate this via a load balancer and VPC Link to API Gateway.

Are there any better or easier approches to use python or node js scrips as API Gateway backend without using lambda and with access to VPC components from the scripts to avoid the long cold start times?

There's lots of really great articles about when to and when not to use a VPC for Lambda functions. A recent one by Yan Cui that looks at Lambda in VPC's in depth can be found here .

One strategy that we've successfully used is to keep our functions inside a VPC hot/warm. The strategy we use is described here but at a high level you can keep your function hot/warm by setting a CloudWatch event that invokes the function with a "warmer" event, which causes it to stay active. We do this with a number of functions, that operate inside a VPC, and this eliminates our cold-start issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM