An AWS Lambda function is configured to run inside a private subnet of a custom VPC. The function retrieves transaction data from an internal Amazon RDS database and must then send a confirmation request to an external, public HTTP API. The database connection is successful, but the external API call times out. Which network configuration change will resolve the timeout issue?
- Place a NAT Gateway in a public subnet, and configure the private subnet's route table to route outbound internet traffic () to the NAT Gateway.Cevap
- BRelocate the Lambda function to a public subnet of the VPC so that it can directly assign a public IP address to its elastic network interface (ENI).
- CUpdate the trust policy of the Lambda function's execution role to grant assume role permissions to the external API's domain.
- DMigrate the external API credentials from the Lambda function code to AWS Secrets Manager and create an interface VPC endpoint for Secrets Manager in the private subnet.
Cevap
Place a NAT Gateway in a public subnet, and configure the private subnet's route table to route outbound internet traffic to the NAT Gateway.
For resources inside a private subnet to establish outbound connections to the internet, they must route traffic through a NAT Gateway. The NAT Gateway must be located in a public subnet and have a route from the private subnet's route table pointing to it.
Adım Adım Çözüm
Anahtar Kavram
VPC Routing for Lambda Functions needing Public and Private Access
Tahmini Süre:55s