A company wants to connect a serverless microservice to an Amazon ElastiCache cluster located in a private VPC subnet. The microservice is implemented as an AWS Lambda function that must also call a public third-party weather API over the internet.
Which two configurations are required to establish this network connectivity? (Select two.)
- Associate the Lambda function with the private subnets of the VPC where the Amazon ElastiCache cluster is located.Cevap
- Configure a NAT Gateway in a public subnet, and update the private subnets' route tables to route outbound internet traffic to the NAT Gateway.Cevap
- CDeploy the Lambda function in a public subnet of the VPC and configure it with a public IPv4 address.
- DAssign the execution role a trust policy that permits direct internet routing without a NAT Gateway.
- EEmbed static AWS credentials directly into the Lambda function's environment variables to authenticate with VPC endpoints.
Cevap
Associate the Lambda function with the private subnets of the VPC where the Amazon ElastiCache cluster is located, and configure a NAT Gateway in a public subnet to route outbound internet traffic from those private subnets.
To access private VPC resources such as an Amazon ElastiCache cluster, the Lambda function must be configured to run inside the VPC's private subnets. However, doing so removes its default internet access. To restore internet access (necessary for calling the external weather API), a NAT Gateway must be deployed in a public subnet, and the private subnets' route tables must direct 0.0.0.0/0 traffic through that NAT Gateway.
Adım Adım Çözüm
Anahtar Kavram
AWS Lambda VPC networking and outbound internet connectivity