A developer has configured an AWS Lambda function inside a private subnet of a VPC to connect to an internal database. The function also needs to call an external API on the public internet, but all connection attempts to the external API time out. Which configuration change will resolve this issue while maintaining access to the private database?
- Route the outbound traffic from the private subnet containing the Lambda function through a NAT Gateway.Cevap
- BMove the Lambda function to a public subnet within the VPC to allow direct internet access.
- CConfigure the Lambda function to assign a public IP address to its Elastic Network Interface (ENI).
- DIncrease the Lambda function's execution timeout limit to allow the connection to succeed.
Cevap
Route the outbound traffic from the private subnet containing the Lambda function through a NAT Gateway.
For a Lambda function inside a VPC to access the internet, it must be placed in a private subnet. The outbound traffic from this private subnet must be routed to a NAT Gateway located in a public subnet, which then routes the traffic to the internet through an Internet Gateway.
Adım Adım Çözüm
Anahtar Kavram
VPC Lambda Internet Connectivity