A developer is building a serverless application. An AWS Lambda function is configured to run in the private subnets of a VPC to retrieve data from a private Amazon Aurora PostgreSQL DB cluster. The Lambda function also needs to call a public web service to retrieve reference data. Currently, the Lambda function can connect to the database but cannot connect to the public web service. Which two actions must the developer take to allow the function to connect to the public web service while maintaining access to the private database? (Select two.)
- Configure a NAT Gateway in a public subnet of the VPC and update the route tables of the private subnets to route traffic destined for 0.0.0.0/0 through the NAT Gateway.Cevap
- Ensure the Lambda function's IAM execution role has the permissions defined in the AWSLambdaVPCAccessExecutionRole managed policy.Cevap
- CAssociate the Lambda function with the public subnets of the VPC to allow the function to automatically receive a public IP address.
- DCreate a Gateway VPC Endpoint for the public web service and associate it with the route tables of the subnets.
- EConfigure the Lambda function to use a customer-managed IAM role without VPC-related permissions to bypass security group rules.
Cevap
To allow the Lambda function to access the public web service while keeping database access, configure a NAT Gateway in a public subnet of the VPC, update the private subnets' route tables to route outbound traffic through it, and ensure the Lambda function's execution role has the permissions defined in the AWSLambdaVPCAccessExecutionRole policy.
To route outbound internet traffic from a VPC-enabled Lambda function, the function must be deployed in private subnets, and the subnet route tables must route 0.0.0.0/0 through a NAT Gateway. In addition, the Lambda function requires the AWSLambdaVPCAccessExecutionRole managed policy to allow it to provision the necessary network interfaces (ENIs) inside the customer VPC.
Adım Adım Çözüm
Anahtar Kavram
AWS Lambda VPC networking, ENI provisioning, and NAT Gateway routing for internet access from private subnets.
Tahmini Süre:2m 0s