An order processing workflow runs on AWS Lambda and needs to interact with an Amazon RDS PostgreSQL database located inside a private subnet of a VPC. Additionally, the function must publish event messages to an external third-party shipping API. The Lambda function is configured with access to the same private subnets as the database. While database operations succeed, the outbound HTTP requests to the shipping API fail with connection timeout errors.
Which TWO network configuration steps will resolve the outbound connectivity issue to the shipping API?
- Configure a NAT Gateway within a public subnet of the VPC.Cevap
- Update the route table of the private subnets to route traffic destined for 0.0.0.0/0 to the NAT Gateway.Cevap
- CAttach an Internet Gateway directly to the private subnets and add a default route pointing to it.
- DConfigure the Lambda function to use public subnets and enable public IP address allocation.
- EIncrease the execution timeout and allocated memory of the Lambda function to prevent the shipping API connection from timing out.
Cevap
The correct actions are to configure a NAT Gateway within a public subnet of the VPC, and to update the route table of the private subnets to route traffic destined for 0.0.0.0/0 to that NAT Gateway.
When an AWS Lambda function is configured to run inside a VPC, it utilizes Hyperplane ENIs to connect to the designated subnets. If it is attached to private subnets to communicate with internal resources like databases, it does not have access to the public internet by default. To resolve this, a NAT Gateway must be provisioned in a public subnet (which has a route to an Internet Gateway), and the route table associated with the Lambda function's private subnets must direct all outbound traffic (0.0.0.0/0) to the NAT Gateway.
Adım Adım Çözüm
Anahtar Kavram
Lambda VPC Networking and Internet Access