SAP-C02 Design for New Solutions Practice Question
A company is designing a serverless application using AWS Lambda that needs to access a private Amazon RDS for MySQL database. The Lambda function is deployed in a VPC with the appropriate security groups. The database is in a private subnet. The company wants to avoid storing database credentials in the Lambda function code. What should the company do to securely access the database?
⚠ Common exam trap
Many candidates confuse AWS Systems Manager Parameter Store (Option D) with Secrets Manager, but Parameter Store lacks native automatic rotation and is not the best practice for database credentials requiring rotation, making Secrets Manager the correct choice for this scenario.
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
✓
Store the database credentials in AWS Secrets Manager and retrieve them using the Secrets Manager API in the Lambda function.
Option C is the best answer. AWS Secrets Manager securely stores database credentials and supports automatic rotation, and Lambda can retrieve them at runtime through the Secrets Manager API without hardcoding credentials. Option A (IAM database authentication) is valid only if the RDS MySQL instance is explicitly configured for IAM authentication and is not the general best practice for avoiding stored credentials. Option B exposes credentials in environment variables, and Option D (Parameter Store) lacks native automatic rotation for RDS credentials.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Create an IAM role that allows Lambda to access the RDS instance using IAM database authentication.
Why it's wrong here
IAM database authentication allows the Lambda function to authenticate to the RDS instance using an IAM role, eliminating the need to store credentials. The Lambda function's IAM role must be granted the necessary permissions to use IAM auth for the database.
- ✗
Pass the database credentials as environment variables to the Lambda function.
Why it's wrong here
Passing database credentials as environment variables is insecure because they can be exposed in logs or during function inspection. This does not follow security best practices.
- ✓
Store the database credentials in AWS Secrets Manager and retrieve them using the Secrets Manager API in the Lambda function.
Why this is correct
AWS Secrets Manager provides a secure, auditable service for storing and automatically rotating database credentials. The Lambda function can retrieve the credentials at runtime via the Secrets Manager API, avoiding hard-coded secrets.
- ✗
Store the database credentials in AWS Systems Manager Parameter Store and retrieve them in the Lambda function.
Why it's wrong here
AWS Systems Manager Parameter Store can store secrets, but it lacks native automatic rotation and is not the best practice for database credentials requiring rotation. Secrets Manager is preferred.
Visual reference
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.