SAP-C02 Continuous Improvement for Existing Solutions Practice Question
A company uses AWS CodePipeline to deploy a serverless application built with AWS SAM. The pipeline has a source stage from CodeCommit, a build stage using CodeBuild, and a deploy stage using CloudFormation. The team wants to ensure that the application is automatically tested in a staging environment before being deployed to production. The testing should include integration tests that simulate user interactions. Which solution should a solutions architect recommend to meet these requirements with minimal changes?
⚠ Common exam trap
The trap here is assuming that CodeDeploy hooks or manual approvals can provide automatic integration testing, but they either require significant pipeline changes or do not automate the testing process.
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 new stage to the pipeline after the build stage that uses CodeBuild to run integration tests against a staging environment created by a separate CloudFormation stack.
Adding a dedicated test stage after the build stage allows integration tests to run automatically against a staging environment before production deployment. CodeBuild can execute test scripts, and a separate CloudFormation stack can create the staging environment. This integrates cleanly with CodePipeline and requires minimal changes, ensuring tests are run automatically and consistently.
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 manual approval action before the deploy stage and require testers to run integration tests locally before approving.
Why it's wrong here
Manual approval does not automate testing; it relies on human action, which is error-prone and not automatic. It also does not provision a staging environment or run tests. This solution fails to meet the requirement for automatic testing and adds delays. It is not a recommended practice for continuous integration and delivery.
- ✗
Use AWS CodeDeploy to manage the deployment and configure a pre-traffic hook that runs integration tests on the staging environment before shifting traffic to production.
Why it's wrong here
CodeDeploy is primarily for EC2, Lambda, and ECS deployments, and while it supports hooks, it is not integrated with CloudFormation deployments in CodePipeline in the same way. Setting up CodeDeploy for a serverless application would require significant changes to the pipeline, and the pre-traffic hook is for Lambda deployments, not for testing a separate staging environment. This adds unnecessary complexity.
- ✗
Configure the existing deploy stage to deploy to a staging environment first, run tests using a Lambda function triggered by CloudFormation events, and then manually approve production deployment.
Why it's wrong here
This approach mixes deployment and testing, and using Lambda functions triggered by CloudFormation events adds complexity and is not designed for running integration tests. It also requires manual approval, which may not be desired for automatic testing. The solution is less straightforward and increases operational overhead compared to a dedicated test stage.
- ✓
Add a new stage to the pipeline after the build stage that uses CodeBuild to run integration tests against a staging environment created by a separate CloudFormation stack.
Why this is correct
Adding a test stage after build allows integration tests to run against a staging environment before production deployment. CodeBuild can execute test scripts, and a separate CloudFormation stack can provision the staging environment. This approach integrates seamlessly with CodePipeline and requires minimal changes to the existing pipeline structure, ensuring tests pass before production.
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 and reviewed by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
Last reviewed September 2026 · checked against the official Amazon Web Services exam blueprint
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.