DOP-C02 SDLC Automation Practice Question
A team uses AWS CodePipeline with multiple stages: Source, Build, Test, and Deploy. The Test stage runs integration tests against a staging environment. Occasionally, the tests fail due to environment issues, not code issues. The team wants to automatically retry the Test stage up to two times if it fails, but not the Deploy stage. How can this be achieved?
⚠ Common exam trap
The trap is that candidates may mistakenly believe CodePipeline supports automatic per-stage retries through a built-in configuration, when in fact the retry setting only enables manual retries. Automatic retries require external services like EventBridge and Lambda.
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
✓
Create a CloudWatch Events rule that triggers a Lambda function to retry the failed stage.
The correct approach is to use Amazon EventBridge (formerly CloudWatch Events) to detect a stage failure in CodePipeline and trigger an AWS Lambda function that calls the RetryStageExecution API. This provides automatic retries without manual intervention. CodePipeline's built-in retry setting on a stage action is not automatic; it only allows manual retries via the console or API. Option D (Step Functions) is a valid alternative but adds unnecessary complexity for this use case.
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 a CloudWatch Events rule that triggers a Lambda function to retry the failed stage.
Why this is correct
This is correct because CodePipeline emits Amazon CloudWatch Events/EventBridge events on stage state changes, including a 'FAILED' state for a stage. A rule can filter for `detail-type: 'CodePipeline Stage Execution State Change'` with `detail.state: 'FAILED'` and trigger a Lambda function that invokes the `RetryStageExecution` API, passing the `pipelineExecutionId` and `stageName` from the event. This automates the same retry a user would otherwise click, and can include backoff logic or retry counts within the Lambda handler.
- ✗
Configure the Retry setting in the Test stage's action configuration.
Why it's wrong here
CodePipeline's Retry action is not an action-level configuration; it is a manual operation invoked from the pipeline console or via the RetryStageExecution API after a stage fails. The stage's action configuration only defines task properties like commands or environment variables, not failure behavior. Automated retries require an external orchestrator, such as a CloudWatch Events-triggered Lambda, because the pipeline itself has no per-action retry setting to enable.
- ✗
Enable the 'Retry on failure' option in the CodePipeline pipeline settings.
Why it's wrong here
No global 'Retry on failure' option exists in CodePipeline pipeline settings; the only retry mechanism is the manual Retry action on a failed stage. Pipeline settings currently support properties like the service role, artifact bucket, and execution mode, but not an automated retry flag. Therefore, this option is non-functional as described, and automation must be implemented via EventBridge rules and Lambda.
- ✗
Use AWS Step Functions to orchestrate the pipeline and implement retries.
Why it's wrong here
AWS Step Functions lacks native integration for the built-in retry logic required to trigger specific stage repetitions within an existing AWS CodePipeline workflow. While this service excels at orchestrating complex, stateful workflows with custom error handling and branching logic across disparate microservices, it does not provide a mechanism to re-execute individual stages of a predefined pipeline without rebuilding the entire orchestration layer from scratch.
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
Courseiva writes every DOP-C02 question from scratch — 251 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or 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 DOP-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 DOP-C02 exam.