Use RDS Proxy to absorb Lambda connection bursts against RDS for PostgreSQL

Answer Correct answer: C — Create an RDS Proxy and point the Lambda function at the proxy endpoint so invocations reuse pooled database connections.

An ecommerce company runs an application on AWS. The application has an Amazon API Gateway API that invokes an AWS Lambda function. The data is stored in an Amazon RDS for PostgreSQL DB instance. During the company’s most recent flash sale, a sudden increase in API calls negatively affected the application's performance. A solutions architect reviewed the Amazon CloudWatch metrics during that time and noticed a significant increase in Lambda invocations and database connections. The CPU utilization also was high on the DB instance. What should the solutions architect recommend to optimize the application's performance?

  1. Increase the memory of the Lambda function. Modify the Lambda function to close the database connections when the data is retrieved.
  2. Add an Amazon ElastiCache for Redis cluster to store the frequently accessed data from the RDS database.
  3. Create an RDS proxy by using the Lambda console. Modify the Lambda function to use the proxy endpoint. Correct Answer
  4. Modify the Lambda function to connect to the database outside of the function's handler. Check for an existing database connection before creating a new connection.

Community Votes

C
83%
D
17%

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

Community Insight

RDS Proxy sits between Lambda and the database and reuses a small pool of connections, so thousands of concurrent Lambda invocations consume only a handful of database connections, which directly relieves the connection churn and the CPU it causes.

During a flash sale the API call volume spiked, Lambda invocations and database connections surged together, and the RDS instance CPU was high. The pattern is connection storm amplification, where many short-lived Lambda executions each open their own database connection.

Adding an ElastiCache for Redis cluster. Caching frequently read data reduces some queries, but it does nothing to stop the connection storm, and the metrics show connection growth as the dominant problem rather than repeated reads of the same rows.

Community Discussion (17 comments)

titi_r 👍 11 Selected: C
Some guys got confused whether it's possible to create a DB proxy from the Lambda console Yes, you CAN create a proxy from within the Lambda console: open a function -> Configuration -> RDS databases -> Add Proxy, then select a radio button with two options: - Create a new database proxy - Choose an existing database proxy Said that, "C" is correct.
oayoade 👍 7 Selected: C
https://repost.aws/knowledge-center/lambda-rds-database-proxy
altonh 👍 1 Selected: B
I think B will solve the database connection and the DB CPU utilization.
skydev 👍 1 Selected: B
As for me, the correct answer is B. "The CPU utilization also was high on the DB instance" - DB Utilization can be high due to unoptimized queries. Opening a new connection for PG is not a complex operation (it does not consume many resources). Adding connection pooling will not help in this situation, IMHO, because even one unoptimized query is enough to consume all CPU resources on the database layer. ElastiCache will allow query offloading from the DB layer.
TomTom 👍 2 Selected: A
The first part is a significant increase in Lambda invocation and database connection. So, increasing the Lambda function's memory is the quickest solution. This will allow the function to handle more concurrent requests and reduce cold start times, immediately improving response times.
AzureDP900 👍 1
Creating an RDS proxy by using the Lambda console and modifying the Lambda function to use the proxy endpoint can help improve performance during peak usage periods like flash sales. This approach has several advantages: C is right Reduced Database Load: By using a connection pool provided by the RDS proxy, you can reduce the number of database connections and queries, which can help decrease CPU utilization and improve overall system performance. Improved Response Times: With an RDS proxy, your application can respond more quickly to user requests, as it doesn't need to wait for database queries to complete.
JoeTromundo 👍 2 Selected: C
"Step 3 1. Open the Functions page in the LAMBDA CONSOLE. 2. In Functions, choose your Lambda function. 3. Choose Configuration, and then choose ADD DATABASE PROXIES. 4. Enter the following variables: Proxy identifier: The name of the proxy. RDS DB instance: A supported MySQL or PostgreSQL DB instance or cluster. Secret: The Secrets Manager that you created. IAM role: The IAM role that you created. Authentication: Choose Password to connect with database credentials or choose Execution role to use the function's IAM credentials for authentication. 5. Choose Add."
zolthar_z 👍 1 Selected: D
With the current options for my is D, because you can't create a RDS Proxy from Lmabda function console, unless the C is misspelled and the answer is only AWS Console
Helpnosense 👍 1 Selected: D
Vote D because answer C is incorrect without mention increasing db server qty increase behind proxy. No improvement by just changing endpoint from db to db proxy. D can help by reusing the db connection instead of one connection per thread. Lambda by default is parallel run inside the handler.
iulian0585 👍 2 Selected: D
C, is wrong Creating Proxy: Within the RDS console, find the "Proxies" section and click on "Create proxy".
TonytheTiger 👍 3 Selected: C
Option C: Read AWS Blog - Using Amazon RDS Proxy w/ AWS Lambda https://aws.amazon.com/blogs/compute/using-amazon-rds-proxy-with-aws-lambda/ Read Section " Create and attach a proxy to a Lambda function " Next, use the Lambda console to Add a Database proxy to a Lambda function. Sign into the AWS Lambda console and open the Lambda function you would like to enable RDS Proxy. This Lambda function needs to be configured for access to the same VPC and Subnets as your RDS database.
YOUSSEFSWAID 👍 2
C, is wrong Creating Proxy: Within the RDS console, find the "Proxies" section and click on "Create proxy".
teo2157 👍 1 Selected: D
A) Incorrect because the issue is at database level B) Partially correct but there's one step missed because you have to modify endpoint for the lambda function C) This is the tricky one, it's almost correct and the best option except for one comment, it's said "Create an RDS proxy by using the Lambda console" the RDS proxy is not created in the lambda console but in the RDS console.... D) Totally correct, https://docs.aws.amazon.com/lambda/latest/dg/best-practices.html Said that, going for D but I found this question very tricky....
pangchn 👍 3 Selected: C
BCD all looks good. I vote for C
djangoUnchained 👍 2
Almost answered C before realizing it was a trap. You don't create RDS Proxies from the LAMBDA console, it is done from the RDS console. D is the best answer.
Dgix 👍 4 Selected: C
C, for the reasons oayoade links to. D is a trap: moving the DB connection outside of the handler obviates the need for keeping track of DB connections. However, C is an even better alternative.
CMMC 👍 1 Selected: D
check to re-use any existing DB connection across multiple invocations of Lambda function

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

RDS Proxy maintains a connection pool and reuses connections across Lambda invocations, so a large burst of concurrent function executions maps to a small, fixed number of database connections. Pointing the function at the proxy endpoint raises the effective concurrency the database can serve and reduces the connection setup overhead that was driving the DB CPU. The proxy can be created from the Lambda configuration console, so no infrastructure redesign is needed.

Why the Other Options Are Wrong

A: Increasing Lambda memory speeds up the function but does not change the number of database connections, and relying on the code to close connections does not help during a concurrency burst. B: An ElastiCache for Redis cluster reduces repeated reads of hot data but leaves the connection storm untouched, and the metric that spiked most was connections. D: Moving connection handling outside the handler is an anti-pattern because a warm Lambda container reuses global state unpredictably across concurrent environments, and it still does not solve the underlying burst.

Community Comment Notes

The community voted 75 to 1 for C, and the main doubt was whether an RDS proxy can be created from the Lambda console. Commenters confirmed it can, from the function's Configuration tab under RDS databases, and cited the AWS re:Post knowledge center article on using RDS Proxy with Lambda.

Official Reference

Related Analysis

Practice All SAP-C02 Questions

Access 85 questions with complete answers and detailed explanations.

View Full SAP-C02 Practice Test →

← Back to SAP-C02 Study Guide