Front the Aurora reader endpoint with RDS Proxy and open the connection outside the Lambda handler

Answer Correct answer: A, C, E — use RDS Proxy against the reader endpoint, connect through the proxy, and open the connection outside the handler.

A DevOps engineer is building an application that uses an AWS Lambda function to query an Amazon Aurora MySQL DB cluster. The Lambda function performs only read queries. Amazon EventBridge events invoke the Lambda function. As more events invoke the Lambda function each second, the database's latency increases and the database's throughput decreases. The DevOps engineer needs to improve the performance of the application. Which combination of steps will meet these requirements? (Choose three.)

  1. Use Amazon RDS Proxy to create a proxy. Connect the proxy to the Aurora cluster reader endpoint. Set a maximum connections percentage on the proxy. Correct Answer
  2. Implement database connection pooling inside the Lambda code. Set a maximum number of connections on the database connection pool.
  3. Implement the database connection opening outside the Lambda event handler code. Correct Answer
  4. Implement the database connection opening and closing inside the Lambda event handler code.
  5. Connect to the proxy endpoint from the Lambda function. Correct Answer

Community Votes

ACE
84%
ADE
16%

84% of anonymous learners picked answer ACE. Votes are pick records left by other test-takers — they are not the verified answer.

Community Insight

RDS Proxy with the Aurora reader endpoint plus a bounded maximum connections percentage (A) and connecting the Lambda function to the proxy endpoint (E) together remove the connection-churn problem at the infrastructure layer. Opening the connection outside the Lambda event handler (C) is what makes reuse possible across invocations in the same execution environment. In-Lambda connection pooling (B) adds application-level pooling without eliminating per-invocation setup, and opening and closing connections inside the handler (D) guarantees a new connection per invocation, which is the current problem.

As EventBridge invokes the Lambda function more frequently, each invocation opening its own database connection exhausts connection capacity and raises latency. Amazon RDS Proxy sits in front of the Aurora reader endpoint and reuses database connections across invocations, with a maximum connections percentage bounding the load. The Lambda function connects through the proxy endpoint, and establishing the connection outside the event handler allows it to be reused across warm invocations instead of being recreated per request.

Opening and closing the database connection inside the Lambda event handler (D)—this guarantees a fresh connection on every invocation, which is precisely the behavior causing connection exhaustion; WhyIronMan cited the AWS blog showing the Node.js example opening the connection outside the handler. Implementing a connection pool inside the Lambda code (B)—application-level pooling does not reuse connections across concurrent Lambda environments and leaves more work to the application than the managed proxy already handles.

Community Discussion (8 comments)

dkp 👍 6 Selected: ACE
Opening and closing database connections outside the Lambda handler allows for efficient reuse of connections and implements connection pooling
WhyIronMan 👍 6 Selected: ADE
A, D, E For those going with A,C,E, the same link already provided here https://aws.amazon.com/blogs/compute/using-amazon-rds-proxy-with-aws-lambda/ in the nodejs/javascript code you can see that database connection opening (connection.connect) and closing (connection.end) are being handled INSIDE the handler function, which is correct because you want to open connections but it is a good practice to close connections
GripZA 👍 3 Selected: ACE
"By opening the database connection outside the event handler, the connection can be reused across multiple invocations, which reduces the overhead of establishing new connections repeatedly."
jamesf 👍 4 Selected: ACE
Should be ACE Opening database connections OUTSIDE the Lambda handler allows for efficient reuse of connections and implements connection pooling
c3518fc 👍 4 Selected: ACE
https://aws.amazon.com/blogs/compute/using-amazon-rds-proxy-with-aws-lambda/
L1_ 👍 5 Selected: ACE
ACE: I also agree - https://aws.amazon.com/blogs/compute/using-amazon-rds-proxy-with-aws-lambda/
DanShone 👍 5 Selected: ACE
I agree
Seoyong 👍 5 Selected: ACE
perfect

Comments & Corrections

No comments yet — spotted an error or have a note? Share it below.

Log in to comment, report an error, or add a note about this question.

Submitted for moderation before publishing. Keep it helpful and respectful.

Expert Analysis

Why the Answer Is Correct

Amazon RDS Proxy maintains a pool of established database connections and reuses them across Lambda invocations, which directly removes the connection setup overhead that is driving up latency. Creating the proxy against the Aurora cluster reader endpoint and setting a maximum connections percentage (A) keeps the proxy from overwhelming the database, and pointing the Lambda function at the proxy endpoint (E) routes its read queries through that pool. In addition, opening the database connection outside the Lambda event handler (C) means a warm execution environment reuses its existing connection on subsequent invocations, which is what makes the reuse effective rather than per-request.

Why the Other Options Are Wrong

B implements connection pooling inside the Lambda code with a maximum connection count. This shifts the burden to the application, cannot share connections across separate Lambda execution environments, and duplicates what RDS Proxy already manages more efficiently. D opens and closes the connection inside the handler, forcing a new database connection on every single invocation and reproducing the exact exhaustion problem described; the AWS blog's Node.js example deliberately opens the connection outside the handler, which WhyIronMan cited when arguing against it. A, C, and E are the correct combination.

Community Comment Notes

Community voted A,C,E (84), with A,D,E a 16 percent minority. Several commenters stressed that opening the database connection outside the Lambda handler allows reuse across multiple invocations and implements pooling, which is the crux of why D is wrong, and linked the AWS blog on using RDS Proxy with Lambda.

Official Reference

Related Analysis

Practice All DOP-C02 Questions

Access 85 questions with complete answers and detailed explanations.

View Full DOP-C02 Practice Test →

← Back to DOP-C02 Study Guide