- Newest
- Most votes
- Most comments
Hi there,
I understand that you have placed your Lambda inside a VPC in order to assign it a static IP, however you are observing a 502 time out error as a result.
Since the timeout error only occurs when you place the Lambda inside your VPC, this suggests that there may be a misconfiguration in your Lambda-VPC setup. To resolve this, please ensure that your setup is configured as follows:
1. Your Lambda must reside inside a private subnet (s). A private subnet is one which has a route to a NAT Gateway in it's routing table. Please review the subnets in which you have placed your Lambda function, and ensure that they are private.
2. If you already have a route to the NAT Gateway, ensure that the NAT Gateway itself resides inside a public subnet. A public subnet is one which is has a route to an Internet Gateway in its routing table. Please review the subnet in which you have placed your NAT Gateway, and ensure that it is public.
In summary, when you place a Lambda function inside a VPC, it must be configured as mentioned above for it to be able to access public endpoints (over the internet), otherwise, a time out error is expected.
For more detailed guidance on setting up your Lambda with a VPC, please see: https://aws.amazon.com/premiumsupport/knowledge-center/internet-access-lambda-function/
Kind Regards,
Ahmad
Relevant content
- AWS OFFICIALUpdated 7 months ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 3 years ago
- AWS OFFICIALUpdated a year ago
Does this help you? https://repost.aws/questions/QUrmtLpnvWRJeDeeSbJZ6H2g/static-ip-for-lambda