An application processes file uploads from an Amazon S3 bucket using an AWS Lambda function. The function needs to write data to an Amazon RDS database located in a private subnet of an Amazon VPC, and also send status updates to an external third-party API. The function is configured to run inside the same private VPC subnet. During testing, the function successfully writes to the database but fails with network timeouts when calling the external API. Which configuration change will resolve this issue?
- Configure the Lambda function to use private subnets that have a route to a NAT Gateway in a public subnet of the VPC.Cevap
- BAssociate the Lambda function with the public subnets of the VPC to allow direct outbound access through the Internet Gateway.
- CIncrease the execution timeout of the Lambda function to 15 minutes to allow sufficient time for the connection to the external API to establish.
- DModify the trust policy of the Lambda function's IAM execution role to allow the external third-party API service to assume the role.
Cevap
Configure the Lambda function to use private subnets that have a route to a NAT Gateway in a public subnet of the VPC.
When a Lambda function is configured to connect to a VPC, it does not have direct access to the internet. To allow the function to connect to both the RDS database in the private subnet and the external third-party API, the function must be configured to run in private subnets. The routing table for these private subnets must include a route directing internet-bound traffic (0.0.0.0/0) to a NAT Gateway that is situated in a public subnet of the VPC.
Adım Adım Çözüm
Anahtar Kavram
AWS Lambda VPC networking and outbound internet access
Tahmini Süre:1m 30s