Lambda with VPC timeout from API Gateway

0

I have a lambda .net 6 with sample API. Without VPC on lambda, it's working fine from API Gateway. I attach a VPC, on lambda, I receive timeout on INIT_START on my .net 6 lambda. I have log on my .net 6 API and I not logging nothing with a VPC. (I put custom log when my .net 6 will start)

INIT_REPORT Init Duration: 180000.68 ms Phase: invoke Status: timeout

The API path it's the same with VPC and without VPC.

Luca
已提问 2 个月前129 查看次数
2 回答
1
已接受的回答

Most probable cause is because your lambda function is not being able to communicate with Lambda Service, for not having either a NAT Gateway/instance to access internet or not having a vpc endpoint to lambda service. Please check:

AWS
已回答 2 个月前
profile picture
专家
已审核 2 个月前
profile pictureAWS
专家
已审核 2 个月前
  • Sorry, I don't understand. Lambda can't "answer" to API Gateway or Lambda can't start because VPC haven't some configuration? I don't need internet access on my lambda

  • Hi Luca, the execution environments where your lambda function code is executed, need communication back with Lambda service itself. By default, Lambda runs your functions in a secure VPC with access to AWS services and the internet. Lambda owns this VPC, which isn't connected to your account's default VPC. When you connect a function to a VPC in your account, the function can't access the internet unless your VPC provides access. To access Lambda service endpoints it needs access via either by your vpc gateways (nat gateway and internet gateway) or by a vpc interface endpoint.

0

I created a NAT and a route on subnet used by the Lambda

Luca
已回答 2 个月前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则