Soru

Zorluk: KolayDebugging Lambda Execution and Configuration Issues

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?

  1. Deploy a NAT Gateway in a public subnet of the VPC.Cevap
  2. Add a route in the private subnets' route table that directs destination 0.0.0.0/0 to the NAT Gateway.Cevap
  3. C
    Configure the Lambda function to assign a public IP address to its network interfaces.
  4. D
    Increase the Lambda function's timeout configuration to the maximum limit of 15 minutes.
  5. E
    Reconfigure 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

1
Analyze the connectivity issue.
The function can access DynamoDB (via VPC Gateway Endpoint) but times out accessing a public external API, meaning there is no route to the public internet.
Identify if the issue is a networking path limitation or resource configuration.
2
Select the correct NAT gateway deployment.
A NAT Gateway must be provisioned in a public subnet which has internet connectivity.
Lambda functions in private subnets require a NAT Gateway to route traffic to public endpoints.
3
Configure the route table for the private subnets.
A default route (0.0.0.0/0) is added pointing to the NAT Gateway.
Ensure outbound traffic from the private subnet is directed correctly to the NAT Gateway.

Anahtar Kavram

VPC Networking for AWS Lambda
Tahmini Süre:1m 0s
Bu soruyu puanla