An AWS Lambda function is configured to run inside private subnets of a custom VPC. The function needs to call a public external payment gateway API and also write results to an Amazon DynamoDB table. During testing, the function successfully connects to DynamoDB via a VPC gateway endpoint, but the connection attempts to the external payment gateway API consistently fail with connection timeout errors. The Lambda function's execution role has the AWSLambdaVPCAccessExecutionRole policy attached, and its security group allows all outbound traffic. Which two actions must the developer take to resolve the external API connectivity issue?
- Deploy a NAT Gateway in a public subnet of the VPC.Cevap
- Add a route in the private subnets' route table that directs destination 0.0.0.0/0 to the NAT Gateway.Cevap
- CConfigure the Lambda function to assign a public IP address to its network interfaces.
- DIncrease the Lambda function's timeout configuration to the maximum limit of 15 minutes.
- EReconfigure the Lambda function to run in public subnets of the VPC.
Cevap
Deploy a NAT Gateway in a public subnet of the VPC, and add a route in the private subnets' route table directing internet-bound traffic (0.0.0.0/0) to the NAT Gateway.
For an AWS Lambda function inside a VPC to access the public internet, it must be associated with private subnets. The private subnets must have a route in their route table (0.0.0.0/0) pointing to a NAT Gateway that is hosted in a public subnet. The public subnet must have a route to an Internet Gateway.
Adım Adım Çözüm
Anahtar Kavram
VPC Networking for AWS Lambda
Tahmini Süre:1m 0s