DVA-C02 · Question #81
DVA-C02 Question #81: Real Exam Question with Answer & Explanation
The correct answer is B: Use Amazon RDS Proxy to create a proxy that connects to the DB instance. Update the Lambda. AWS Lambda can exhaust RDS connection limits during concurrency spikes because each Lambda execution opens its own connection. Amazon RDS Proxy pools and reuses database connections, eliminating the 'too many connections' error.
Question
A company has a critical application on AWS. The application exposes an HTTP API by using Amazon API Gateway. The API is integrated with an AWS Lambda function. The application stores data in an Amazon RDS for MySQL DB instance with 2 virtual CPUs (vCPUs) and 64 GB of RAM. Customers have reported that some of the API calls return HTTP 500 Internal Server Error responses. Amazon CloudWatch Logs shows errors for "too many connections." The errors occur during peak usage times that are unpredictable. The company needs to make the application resilient. The database cannot be down outside of scheduled maintenance hours. Which solution will meet these requirements?
Options
- ADecrease the number of vCPUs for the DB instance. Increase the max_connections setting.
- BUse Amazon RDS Proxy to create a proxy that connects to the DB instance. Update the Lambda
- CAdd a CloudWatch alarm that changes the DB instance class when the number of connections
- DAdd an Amazon EventBridge rule that increases the max_connections setting of the DB instance
Explanation
AWS Lambda can exhaust RDS connection limits during concurrency spikes because each Lambda execution opens its own connection. Amazon RDS Proxy pools and reuses database connections, eliminating the 'too many connections' error.
Common mistakes.
- A. Decreasing vCPUs reduces compute capacity and does not increase the connection limit; max_connections is tied to instance memory, and reducing resources would worsen performance under peak load.
- C. A CloudWatch alarm that changes the DB instance class causes a brief outage during instance modification, violating the requirement that the database cannot be down outside scheduled maintenance.
- D. EventBridge cannot dynamically modify the max_connections parameter at runtime; that parameter is set via a DB parameter group and requires a reboot to take effect on most RDS instance classes.
Concept tested. Amazon RDS Proxy connection pooling for Lambda
Reference. https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/rds-proxy.html
Community Discussion
No community discussion yet for this question.