Secure Database Credentials with AWS Secrets Manager and Lambda
A company is designing a serverless application that uses AWS Lambda to process events from Amazon DynamoDB Streams. The Lambda function updates an Amazon RDS for MySQL database. The company expects a high volume of updates and is concerned about the Lambda function causing too many connections to the database. How should the company design the solution to manage the database connection pool effectively?
⚠ Common exam trap
It's easy for candidates to think batching or reducing concurrency is the solution, but the real challenge is managing connection reuse under elastic scaling, which only a dedicated proxy like RDS Proxy can solve without sacrificing throughput.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Use Amazon RDS Proxy to pool database connections, and configure the Lambda function to connect through the proxy.
Amazon RDS Proxy sits between the Lambda function and the RDS database, maintaining a pool of established connections. When Lambda invocations scale up, they reuse connections from the pool instead of opening new ones, preventing the database from being overwhelmed. This is the recommended AWS pattern for serverless applications with high concurrency and relational databases.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Increase the Lambda function timeout and use a single database connection per function instance.
Why it's wrong here
A longer timeout does not bound concurrency; each function instance still holds its own connection, so scaling creates the same connection storm. It is tempting because timeouts govern execution duration, and would be correct for long-running queries, not for pooling connections across instances.
- ✓
Use Amazon RDS Proxy to pool database connections, and configure the Lambda function to connect through the proxy.
Why this is correct
RDS Proxy maintains a shared pool of database connections and multiplexes Lambda invocations onto them, so each concurrent function no longer opens its own MySQL connection. This directly addresses the stem's concern about excessive connections during high-volume updates.
- ✗
Use a singleton Lambda function with a reserved concurrency of 1 to ensure only one connection is used.
Why it's wrong here
Reserved concurrency of 1 serialises all stream processing, throttling throughput and leaving records unprocessed within the stream's retention window. It is tempting because it caps connections, and would suit low-volume workloads where ordering matters more than parallelism.
- ✗
Use a Lambda function that batches records from DynamoDB Streams and uses a single database connection per batch.
Why it's wrong here
Batching records still opens a fresh connection per batch invocation, so concurrent Lambda executions multiply connections against RDS. It is tempting because batching reduces invocation count, and would suit throughput-sensitive stream processing where connection reuse is handled elsewhere, such as RDS Proxy.
Quick reference
Cloud Service Model Comparison
| Model | You Manage | Provider Manages | Examples |
|---|---|---|---|
| IaaS | OS, runtime, apps, data | Hardware, hypervisor, networking | EC2, Azure VMs, GCP Compute Engine |
| PaaS | Apps and data | OS, runtime, middleware, hardware | Elastic Beanstalk, Azure App Service |
| SaaS | Data and settings only | Everything else | Microsoft 365, Salesforce, Workday |
| FaaS / Serverless | Function code only | Infra, scaling, runtime | Lambda, Azure Functions, Cloud Run |
| CaaS | Containers and apps | Kubernetes, OS, hardware | EKS, AKS, GKE |
Go deeper
Related to this question
About these practice questions
One of 984 original SAP-C02 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This SAP-C02 practice question is part of Courseiva's free Amazon Web Services certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the SAP-C02 exam.