A developer is implementing an AWS Lambda function that needs to query an Amazon RDS PostgreSQL database located in a private VPC subnet. The function must also make outbound HTTP POST requests to an external API on the public internet, and trace all downstream database queries using AWS X-Ray.
Which two configurations are required to meet these requirements? (Select two.)
- Configure the Lambda function to run inside the private subnets of the VPC, and route internet-bound traffic through a NAT Gateway located in a public subnet.Answer
- Enable active tracing on the Lambda function configuration, and use the AWS X-Ray SDK to instrument the database client in the function code.Answer
- CDeploy the Lambda function in the public subnets of the VPC to allow both direct access to the database via local routing and direct public internet access through the Internet Gateway.
- DModify the Lambda function's IAM execution role trust policy to allow the RDS database service principal to assume the role.
- EEnable active tracing on the Lambda function to automatically trace database queries without codebase modifications.
Answer
The Lambda function must be configured to run in the private subnets of the VPC, routing outbound internet traffic through a NAT Gateway. In addition, the developer must enable active tracing on the Lambda function and use the AWS X-Ray SDK within the code to instrument the database client.
To satisfy both database access in a private subnet and public internet connectivity for external APIs, the Lambda function must be configured inside the private subnets of the VPC, with the private subnets routing outbound traffic to a NAT Gateway in a public subnet. Additionally, active tracing must be enabled on the Lambda function, and the database client within the codebase must be instrumented using the AWS X-Ray SDK to record downstream database queries.
Step-by-Step Solution
Key Concept
AWS Lambda VPC networking and downstream AWS X-Ray SDK database instrumentation.