Question 217 of 724
DVA-C02 Security Practice Question
A company is implementing a CI/CD pipeline using AWS CodePipeline and CodeBuild. The pipeline deploys a serverless application. Which TWO actions should be taken to securely manage the database credentials used by the application?
⚠ Common exam trap
Candidates often think CloudFormation parameters (Option C) are secure because they are not hardcoded, but they overlook that parameters can be exposed in plaintext in stack outputs, events, and parameter store, and they lack built-in encryption and rotation capabilities compared to Secrets Manager.
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 AWS Lambda environment variables with encryption using a KMS key.
AWS Lambda environment variables can be encrypted at rest using a KMS key, providing a secure way to store sensitive data like database credentials without hardcoding them in the function code. This approach ensures that the credentials are decrypted only when the Lambda function executes, and access to the KMS key can be controlled via IAM policies. Option E is also correct because AWS Secrets Manager is a dedicated service for managing secrets throughout their lifecycle, and CodeBuild can retrieve them securely using an IAM role with appropriate permissions, eliminating the need to store secrets in code or configuration files.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Embed the credentials in the Lambda function code.
Why it's wrong here
Embedding credentials directly within the Lambda function's source code is a severe security vulnerability. These credentials would be committed to version control, making them accessible to anyone with repository access and difficult to rotate without code changes and redeployments. This practice significantly increases the risk of unauthorized access if the code repository is compromised or if the function's deployment package is inspected.
- ✗
Store the credentials in the buildspec.yml file in the CodeCommit repository.
Why it's wrong here
Storing sensitive credentials directly within the buildspec.yml file, which resides in a CodeCommit repository, is highly insecure. This action permanently embeds the secrets into the repository's history, making them visible to anyone with read access to the repository, including past versions. Such exposure makes credential rotation extremely difficult and poses a significant data breach risk.
- ✗
Pass the credentials as CloudFormation parameters during deployment.
Why it's wrong here
Passing sensitive credentials as plain-text CloudFormation parameters during deployment is an insecure practice. While parameters can be used for configuration, they are visible in the CloudFormation console, API calls, and logs, exposing the secret value to anyone with permissions to view stack details. CloudFormation parameters are not designed for secure secret management and lack encryption at rest or in transit for sensitive data.
- ✓
Use AWS Lambda environment variables with encryption using a KMS key.
Why this is correct
Storing sensitive information as AWS Lambda environment variables, encrypted with an AWS Key Management Service (KMS) key, is a secure and recommended practice. Lambda automatically encrypts these variables at rest using the specified KMS key and decrypts them at runtime when the function is invoked. This method prevents credentials from being exposed in plain text within the code or configuration, enhancing security and simplifying secret rotation.
- ✓
Use AWS Secrets Manager to store the credentials and retrieve them in CodeBuild using an IAM role.
Why this is correct
AWS Secrets Manager is a dedicated service for securely storing, managing, and rotating database credentials, API keys, and other secrets. CodeBuild can securely retrieve these credentials at runtime by assuming an IAM role with appropriate permissions to access Secrets Manager. This approach centralizes secret management, supports automatic rotation, and provides robust auditing capabilities, significantly reducing the risk of credential compromise.
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 |
About these practice questions
Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →
Same concept, more angles
1 more way this is tested on DVA-C02
These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.
Variation 1. A company is designing a secure CI/CD pipeline using AWS CodePipeline and AWS CodeBuild. The pipeline must securely store and access sensitive parameters (e.g., API keys) used during the build. Which TWO services can be used to securely store and retrieve these parameters?
hard- ✓ A.AWS Systems Manager Parameter Store (SecureString)
- ✓ B.AWS Secrets Manager
- C.Amazon S3 with server-side encryption
- D.AWS Key Management Service (KMS) alone
- E.AWS CloudFormation parameter store
Why A: AWS Systems Manager Parameter Store (SecureString) and AWS Secrets Manager are both designed to securely store secrets and can be accessed by CodeBuild via IAM roles.
Last reviewed: Jun 24, 2026
This DVA-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 DVA-C02 exam.
Question Discussion
Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.
Sign in to join the discussion.