An ecommerce site uses a Lambda function that writes orders to an Amazon RDS for MySQL database. The service must return order confirmations immediately. During a marketing surge, the operations team saw “too many connections” errors from RDS, even though DB cluster metrics show healthy CPU and memory. What should the developer do to fix the connection errors?
Choose an answer
Tap an option to check your answer.
Correct answer: Open the database connection outside the Lambda handler. Use Amazon RDS Proxy instead of having Lambdas connect directly to the database..
Why this is the answer
The correct answer addresses the issue of too many connections by leveraging Amazon RDS Proxy, which efficiently manages and pools database connections. Opening the database connection outside the Lambda handler is a best practice for reusability, but RDS Proxy is crucial for handling high concurrency from serverless functions like Lambda. RDS Proxy maintains a warm pool of connections, reducing the overhead of establishing new connections for each Lambda invocation and preventing the database from being overwhelmed. Incorrect options: Increasing maxuserconnections and restarting the DB cluster might temporarily alleviate the issue but doesn't solve the underlying problem of connection storms from Lambda, which can still exhaust connections under high load. Using SQS FIFO queues to buffer orders is a good pattern for decoupling and handling spikes, but it doesn't directly solve the "too many connections" error if the Lambda function processing the queue still overwhelms the database. Setting Lambda concurrency to equal or less than available connections is a good practice, but without RDS Proxy, each Lambda still establishes a new connection, which can be inefficient and lead to connection exhaustion.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed