A developer has configured an AWS Lambda function to run inside private subnets of a VPC. The function needs to connect to an external, third-party payment gateway API on the public internet, but the connection attempts are failing due to timeouts. Which configuration change should the developer implement to allow the Lambda function to connect to the external API?
- Deploy a NAT Gateway in a public subnet, and add a route in the private subnet's route table directing outbound traffic to the NAT Gateway.Cevap
- BConfigure the private subnet's route table to route outbound traffic directly to the VPC's Internet Gateway.
- CUpdate the trust policy of the Lambda function's IAM execution role to explicitly allow connections to the payment gateway API domain.
- DStore the payment gateway API URL in Systems Manager Parameter Store and enable automatic parameter rotation.
Cevap
Deploy a NAT Gateway in a public subnet, and add a route in the private subnet's route table directing outbound traffic to the NAT Gateway.
The correct answer provides a valid network path for the Lambda function. Since the Lambda function is placed in a private subnet, it has no public IP address and cannot directly route traffic to an Internet Gateway. Deploying a NAT Gateway in a public subnet and routing the private subnet's outbound traffic to the NAT Gateway allows the Lambda function to reach public endpoints securely.
Adım Adım Çözüm
Anahtar Kavram
Outbound internet connectivity for VPC-enabled Lambda functions requires a NAT Gateway and appropriate route table entries.
Tahmini Süre:1m 0s