DVA-C02 Deployment Practice Question
A developer uses AWS CodePipeline to deploy a serverless application defined with AWS SAM. The pipeline consists of Source (S3), Build (CodeBuild), and Deploy (CloudFormation) stages. The developer wants to run integration tests after the stack is deployed but before the pipeline completes. Which approach should the developer use?
⚠ Common exam trap
Candidates often confuse CloudFormation Outputs with event-driven triggers or assume SAM has built-in post-deployment hooks, when in fact CodePipeline's custom action with Lambda is the correct mechanism for running automated tests after deployment.
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
✓
Add a test stage after the Deploy stage with an action that invokes a Lambda function to run tests.
AWS CodePipeline allows you to add a test stage after the Deploy stage, and you can configure an action that invokes an AWS Lambda function to run integration tests. This ensures tests run automatically after the CloudFormation stack is deployed but before the pipeline completes, meeting the requirement without manual intervention.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
Add a test stage after the Deploy stage with an action that invokes a Lambda function to run tests.
Why this is correct
AWS CodePipeline is designed for continuous delivery, allowing developers to define multiple stages, including a dedicated 'Test' stage. Within this stage, an 'Invoke' action can be configured to execute an AWS Lambda function. This Lambda function can then contain the logic to perform various integration or end-to-end tests against the newly deployed serverless application, ensuring automated validation post-deployment. This approach fully automates the testing process within the pipeline.
- ✗
Use the CloudFormation stack's Outputs to trigger a Lambda function that runs tests.
Why it's wrong here
CloudFormation stack Outputs are primarily used to expose specific resource attributes, such as API Gateway endpoints or S3 bucket names, for consumption by other CloudFormation stacks or external systems. They are static values exported upon stack creation or update and do not inherently possess event-driven capabilities to trigger AWS Lambda functions directly. Therefore, relying on Outputs alone to initiate post-deployment tests is not a supported or practical mechanism within AWS.
- ✗
Configure a post-deployment hook in the SAM template that runs tests.
Why it's wrong here
The AWS Serverless Application Model (SAM) template syntax primarily defines serverless resources and their configurations for deployment via CloudFormation. SAM templates do not natively include a feature for defining "post-deployment hooks" that execute arbitrary code or tests directly within the CloudFormation deployment lifecycle. While custom resources can extend CloudFormation, SAM itself doesn't offer a declarative post-deployment hook for testing, making this an unsupported mechanism for automated testing.
- ✗
Add a manual approval step after Deploy, then run tests manually.
Why it's wrong here
A manual approval step in AWS CodePipeline is designed to pause the pipeline and require human intervention to review and approve the deployment before subsequent stages can proceed. While useful for critical deployments or gatekeeping, it explicitly introduces a non-automated step. Running tests manually after such an approval defeats the purpose of a continuous delivery pipeline, which aims for full automation of build, deploy, and test cycles to ensure rapid and consistent feedback.
Quick reference
AWS S3 Storage Class Comparison
| Storage Class | Min Duration | Retrieval | Use Case |
|---|---|---|---|
| S3 Standard | None | Immediate | Frequently accessed data |
| S3 Standard-IA | 30 days | Immediate | Infrequent access, rapid retrieval |
| S3 One Zone-IA | 30 days | Immediate | Non-critical infrequent data |
| S3 Intelligent-Tiering | None | Immediate–hours | Unknown or changing access patterns |
| S3 Glacier Instant | 90 days | Milliseconds | Archive with instant retrieval |
| S3 Glacier Flexible | 90 days | Minutes–hours | Archive, flexible retrieval |
| S3 Glacier Deep Archive | 180 days | Hours | Long-term compliance archive |
Go deeper
Related to this question
About these practice questions
This DVA-C02 question is part of Courseiva's 724-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
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.