A developer is deploying a backend compliance service using an AWS Lambda function. The function is configured to connect to an Amazon Aurora PostgreSQL database in a private subnet, and it also calls a third-party compliance verification HTTPS endpoint on the internet.
The Lambda function is configured with:
- Execution timeout:
- Memory:
- VPC configuration: Attached to Subnet A and Subnet B
- Security Group: Outbound allows all traffic (`0.0.0.0/0`); Inbound is restricted.
Subnet A's route table has a route for `0.0.0.0/0` pointing to a NAT Gateway located in a public subnet. However, Subnet B's route table has a route for `0.0.0.0/0` pointing directly to an Internet Gateway.
During testing under high concurrency, the developer observes two issues in Amazon CloudWatch Logs:
1. The Lambda function intermittently fails with a timeout error after during peak traffic. The database client connection pool is initialized outside the Lambda handler function.
2. The function fails to connect to the third-party compliance verification endpoint, throwing a network connection timeout, but only during execution threads that run in Subnet B.
Which two actions should the developer take to resolve these execution and configuration issues?
- Associate Subnet B with a route table that routes outbound traffic (`0.0.0.0/0`) to the NAT Gateway instead of the Internet Gateway.Cevap
- Deploy an Amazon RDS Proxy between the Lambda function and the Aurora PostgreSQL database, and update the function to connect to the proxy endpoint.Cevap
- CEnable public IP address assignment in the Lambda function's VPC configuration settings.
- DMove the database client connection pool initialization inside the Lambda handler function so that a new database connection is created and closed on every invocation.
- EConfigure an inbound security group rule for the Lambda function that allows traffic from the NAT Gateway on port .