Enable provisioned concurrency, reuse database connections outside the handler, and route connections through RDS Proxy

Answer Correct answer: B, D, E — enable provisioned concurrency, reuse connections outside the handler, and connect through RDS Proxy.

A company recently deployed its web application on AWS. The company is preparing for a large-scale sales event and must ensure that the web application can scale to meet the demand. The application's frontend infrastructure includes an Amazon CloudFront distribution that has an Amazon S3 bucket as an origin. The backend infrastructure includes an Amazon API Gateway API, several AWS Lambda functions, and an Amazon Aurora DB cluster. The company's DevOps engineer conducts a load test and identifies that the Lambda functions can fulfil the peak number of requests. However, the DevOps engineer notices request latency during the initial burst of requests. Most of the requests to the Lambda functions produce queries to the database. A large portion of the invocation time is used to establish database connections. Which combination of steps will provide the application with the required scalability? (Choose three.)

  1. Configure a higher reserved concurrency for the Lambda functions.
  2. Configure a higher provisioned concurrency for the Lambda functions. Correct Answer
  3. Convert the DB cluster to an Aurora global database. Add additional Aurora Replicas in AWS Regions based on the locations of the company's customers.
  4. Refactor the Lambda functions. Move the code blocks that initialize database connections into the function handlers. Correct Answer
  5. Use Amazon RDS Proxy to create a proxy for the Aurora database. Update the Lambda functions to use the proxy endpoints for database connections. Correct Answer

Community Insight

Three distinct problems exist and each needs its own fix. Cold starts during the initial burst are addressed by provisioned concurrency, which prepares execution environments in advance (B). Connection setup time inside each invocation is addressed by moving the initialization code out of the handler so it runs once per execution environment and the connection is reused (D). Connection establishment at the database itself is addressed by RDS Proxy, which maintains a pool of established Aurora connections and reuses them (E). Note that option D's text as exported reads 'into the function handlers', which inverts the intent; the fix requires the code to run outside the handler.

The load test shows the functions can meet peak volume, but latency spikes on the initial burst because most invocations query the database and a large share of each invocation is spent establishing database connections. Provisioned concurrency pre-initializes execution environments so the burst does not wait on cold starts. Refactoring the functions so connection initialization happens outside the handler allows connections to be reused across invocations. Placing Amazon RDS Proxy in front of Aurora and pointing the functions at the proxy endpoints removes per-invocation connection establishment entirely.

Increasing reserved concurrency (A) — reserved concurrency sets an upper limit and reserves capacity, but it does not pre-initialize environments, so cold starts during the burst remain; WhyIronMan explicitly rejected A for this reason, noting there would be moments when the reserved capacity sits idle while still being paid for. Converting to an Aurora global database and adding cross-Region replicas (C) — this addresses availability and read scaling across Regions, not the per-invocation connection latency identified in the load test, and the outage scenario is not a Region failure.

Community Discussion (20 comments)

WhyIronMan 👍 15 Selected: BC
A. this doesn't directly address the database connection issue and there will be moments were you will be not using it, so spending money B. correct, Configure a higher provisioned concurrency for the Lambda functions: This ensures that Lambda instances are ready to handle bursts of traffic, reducing cold start latency. C. Is correct, if they want to read only D. is wrong because it says "... into the function handlers..." while best practices say to do it OUTSIDE the function handlers. Starting NEW CONNECTIONS is bad thing. F. Is correct, it is a best practice
DanShone 👍 8 Selected: BD
A - Provisioned concurrency – This is the number of pre-initialized execution environments allocated to your function https://docs.aws.amazon.com/lambda/latest/dg/provisioned-concurrency.html D - Initialize SDK clients and database connections outside of the function handler https://docs.aws.amazon.com/lambda/latest/dg/best-practices.html F - RDS Proxy improves scalability by pooling and sharing database connections https://aws.amazon.com/rds/proxy/faqs/?nc=sn&loc=4
79f3aa3 👍 1 Selected: BD
It's BDF. https://docs.aws.amazon.com/lambda/latest/dg/best-practices.html
Waak 👍 1
There should be another option E) Refactor the Lambda functions. Move the code blocks that initialize database connections outside the function handlers.
teo2157 👍 1 Selected: BD
DanShone provided the right links to the answers
seetpt 👍 1 Selected: BC
I think BCF
radhi2024 👍 3 Selected: BC
B C D i correct
trungtd 👍 3 Selected: BC
The person who chose D doesn't understand Lambda at all
Gomer 👍 3 Selected: BC
A. (NO) "Lambda functions can fulfil the peak number of requests." B.(YES) "The number of pre-initialized execution environments allocated to a function. These execution environments are ready to respond immediately to incoming function requests." C.(YES) Chosen in part by process of elimination because neither "A" or "D" is correct. D. (NO) Declaratons "outside of the function's handler method remain initialized" "when the function is invoked again." "if your Lambda function establishes a database connection" "the original connection is used in subsequent invocations." F.(YES) Chosen in part by process of elimination because neither "A" or "D" is correct.
dkp 👍 3
BCF B.Configure a higher provisioned concurrency for the Lambda functions: This will help in maintaining a set number of initialized Lambda instances, reducing cold starts, and providing better scalability. C. Convert the DB cluster to an Aurora global database: This will help in reducing database connection latency for global users by replicating Aurora across multiple regions. F. Use Amazon RDS Proxy to create a proxy for the Aurora database: This will manage database connections efficiently with connection pooling, reducing the time to establish new connections and improving database interaction efficiency.
Ola2234 👍 1
BDF Option A is a waste of resources Option D is not practicable
ogerber 👍 1
ABF, 100%
Shasha1 👍 3
BCF referance: https://repost.aws/knowledge-center/lambda-cold-start
sejar 👍 2 Selected: AB
D is bad pratice as mentioned here. https://docs.aws.amazon.com/lambda/latest/dg/best-practices.html#function-code:~:text=Initialize%20SDK%20clients%20and%20database%20connections%20outside%20of%20the%20function%20handler C - unsure if that helps, if the Lambda function is not replicated to other regions.
dzn 👍 2 Selected: AB
D is bad practice in this situation. Connecting DBs in global scope and using RDS Proxy can further improve performance.
kyuhuck 👍 4 Selected: BD
Configuring a higher reserved concurrency for the Lambda functions (Option A) ensures that a specific number of Lambda instances are available for your function, but it doesn't address the cold start issue as effectively as provisioned concurrency, nor does it directly address the database connection overhead. Therefore, the most effective combination of steps to provide the required scalability and address the identified issue would be Options B (Provisioned Concurrency), F (Amazon RDS Proxy), and a revised understanding of D that focuses on optimizing connection management for efficiency.
kyuhuck 👍 3 Selected: AB
B. Configure a higher provisioned concurrency for the Lambda functions: This ensures that Lambda instances are ready to handle bursts of traffic, reducing cold start latency. F. Use Amazon RDS Proxy to create a proxy for the Aurora database: This directly addresses the issue of database connection overhead, significantly reducing latency by pooling and reusing connections. A. Configure a higher reserved concurrency for the Lambda functions (optional based on specific needs): While this doesn't directly address the database connection issue, it ensures that enough Lambda instances are available to handle the application load, complementing the benefits of provisioned concurrency and RDS Proxy.
Ramdi1 👍 1 Selected: CD
D: By moving connection initialization into the function handler, you avoid the cold start penalty encountered when a new Lambda instance is spun up. Each request can establish a fresh connection, reducing latency during the initial burst. F: RDS Proxy creates a connection pool, eliminating the need for each Lambda invocation to establish a new connection. Reusing connections significantly reduces request latency, especially for short-lived interactions. C: Aurora Global Database distributes data across multiple regions, improving performance for users in different locations. Adding replicas provides additional read capacity, increasing overall database scalability.
thanhnv142 👍 4 Selected: BD
BDF are correct: A: <the Lambda functions can fulfil the peak number of requests> means we dont need to increase this B: correct C: irrelevant D and F: both correct, handling the connection issue
Chelseajcole 👍 2
BF. Reserved concurrency – This represents the maximum number of concurrent instances allocated to your function. When a function has reserved concurrency, no other function can use that concurrency. Configuring reserved concurrency for a function incurs no additional charges. Provisioned concurrency – This is the number of pre-initialized execution environments allocated to your function. These execution environments are ready to respond immediately to incoming function requests. Configuring provisioned concurrency incurs additional charges to your AWS account. For the query, it is the connection issue, so try to connect to a different endpoint

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

The load test isolates three distinct contributors to latency. First, latency during the initial burst indicates cold starts, which provisioned concurrency addresses by pre-initializing a set of execution environments so invocations do not wait for initialization (B). Second, a large portion of invocation time is spent establishing database connections, which is a per-invocation cost inside the handler; refactoring the function so the connection initialization code runs outside the handler lets a warm execution environment reuse its connection across invocations instead of reconnecting each time (D). Third, even with reuse in code, each new execution environment must still open a connection to the cluster, which Amazon RDS Proxy eliminates by pooling established connections to Aurora, with the functions updated to use the proxy endpoints (E). Together these remove the three separate sources of latency.

Why the Other Options Are Wrong

A increases reserved concurrency. Reserved concurrency reserves a portion of the account's concurrency capacity for a function and guarantees that capacity is available, but it does not pre-initialize execution environments, so the cold-start component of the initial-burst latency remains; WhyIronMan, who had the most upvoted comment, specifically noted that A does not address the database connection issue and that reserved capacity would at times go unused while still being paid for. C converts the cluster to an Aurora global database and adds read replicas in additional Regions based on customer locations. This addresses regional availability and read throughput distribution, neither of which is the bottleneck described, since the load test attributes the latency to connection establishment against a database that already meets peak capacity. A note on wording: option D as exported says to move the initialization code 'into' the function handlers, which is the opposite of the fix and matches none of the commenters' reasoning; the requirement that a large portion of invocation time is spent establishing connections can only be resolved by moving that code outside the handler, which is what the correct answer treats it as. Waak identified the same wording problem. B, D, and E are the correct combination.

Community Comment Notes

Community comments were split between B,C and B,D with several referencing an option F that does not exist in this export, which is why no votes were recorded. WhyIronMan, who had the highest-rated comment, agreed that A does not address the connection issue and that B is correct. DanShone and teo2157 both cited the AWS Lambda best practices documentation and supported B together with the connection-reuse refactor, and Waak pointed out that the connection initialization should be moved outside the function handlers. The voting data is unusable for this item because multiple commenters answered for an option letter absent from the option list.

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