
Answer-first summary for fast verification
Answer: Use Amazon RDS Proxy to create a proxy for the database. Modify the Lambda function to use the RDS Proxy endpoint instead of the database endpoint.
## Explanation **Correct Answer: B** **Why Option B is correct:** 1. **Amazon RDS Proxy** is specifically designed to handle connection pooling for database connections, which directly addresses the problem of "a large number of open connections" causing high CPU and memory utilization. 2. RDS Proxy sits between the application and the database, managing a pool of database connections that can be shared across multiple Lambda function invocations. 3. This solution requires minimal changes to the application - only changing the database endpoint in the Lambda function to point to the RDS Proxy endpoint. 4. RDS Proxy helps prevent database connection exhaustion, reduces CPU and memory pressure on the database, and improves application scalability during traffic surges. **Why other options are incorrect:** **Option A:** - Provisioned concurrency for Lambda helps with cold starts but doesn't address the database connection pooling issue. - Modifying the database to be a global database across multiple regions is a major architectural change and doesn't solve the connection pooling problem. **Option C:** - Creating a read replica in a different region doesn't solve the write connection problem (order processing typically involves writes). - Read replicas are for read scaling, not for handling write connection pooling. - Using query string parameters in API Gateway to route traffic adds complexity and doesn't address the core connection pooling issue. **Option D:** - Migrating from Aurora PostgreSQL to DynamoDB is a major architectural change that requires significant application modifications. - This goes against the requirement of "making the least possible changes to the application." - While DynamoDB can handle high throughput, the migration itself is complex and time-consuming. **Key AWS Services Involved:** - **Amazon RDS Proxy**: Managed database proxy service that pools and shares database connections - **AWS Lambda**: Serverless compute service - **Amazon Aurora PostgreSQL**: Relational database service - **Amazon API Gateway**: Managed API service **Best Practice:** When dealing with serverless applications (Lambda) connecting to relational databases, always consider using RDS Proxy to manage database connections efficiently and prevent connection exhaustion during traffic spikes.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
No comments yet.
An ecommerce company has an order-processing application that uses Amazon API Gateway and an AWS Lambda function. The application stores data in an Amazon Aurora PostgreSQL database. During a recent sales event, a sudden surge in customer orders occurred. Some customers experienced timeouts, and the application did not process the orders of those customers.
A solutions architect determined that the CPU utilization and memory utilization were high on the database because of a large number of open connections. The solutions architect needs to prevent the timeout errors while making the least possible changes to the application.
Which solution will meet these requirements?
A
Configure provisioned concurrency for the Lambda function. Modify the database to be a global database in multiple AWS Regions.
B
Use Amazon RDS Proxy to create a proxy for the database. Modify the Lambda function to use the RDS Proxy endpoint instead of the database endpoint.
C
Create a read replica for the database in a different AWS Region. Use query string parameters in API Gateway to route traffic to the read replica.
D
Migrate the data from Aurora PostgreSQL to Amazon DynamoDB by using AWS Database Migration Service (AWS DMS). Modify the Lambda function to use the DynamoDB table.