Enable provisioned concurrency, reuse database connections outside the handler, and route connections 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.)
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)
Comments & Corrections
No comments yet — spotted an error or have a note? Share it below.
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 →