A developer is configuring an AWS Lambda function that must query an Amazon Aurora PostgreSQL database cluster deployed in private subnets within a VPC. The Lambda function also needs to call an external, third-party payment processing API on the public internet. Which network configurations must the developer implement to enable this connectivity? (Select two.)
- Associate the Lambda function with the private subnets where the Amazon Aurora database cluster resides.Answer
- Configure a NAT Gateway in a public subnet, and update the route tables of the private subnets to route outbound traffic through the NAT Gateway.Answer
- CAssociate the Lambda function with the public subnets of the VPC to allow direct outbound internet communication.
- DUpdate the IAM execution role of the Lambda function with a trust policy that allows the vpc.amazonaws.com service principal to assume the role.
- EInitialize the database client by hardcoding the DB credentials in the environment variables and using a custom SDK credential provider inside the handler.
Answer
Associate the Lambda function with the private subnets where the Amazon Aurora database cluster resides, and configure a NAT Gateway in a public subnet while updating the route tables of the private subnets to route outbound traffic through the NAT Gateway.
To connect the Lambda function to the database, it must be integrated with the VPC and associated with the private subnets where the database resides. To connect to the external payment API from inside the private subnets, a NAT Gateway must be configured in a public subnet, and the private subnet route tables must be updated to route outbound traffic to the NAT Gateway.
Step-by-Step Solution
Key Concept
AWS Lambda VPC networking configuration for internal and external resources