DOP-C02 SDLC Automation Practice Question
A DevOps engineer is designing a deployment pipeline for a microservices application on Amazon ECS. The team wants to use blue/green deployments with automatic rollback if CloudWatch alarms are triggered during the deployment. Which combination of services and configurations should the engineer use?
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 CodeDeploy with a blue/green deployment configuration on the ECS service, and configure automatic rollback when CloudWatch alarms are breached.
AWS CodeDeploy natively supports blue/green deployments on Amazon ECS services, and you can configure automatic rollback when CloudWatch alarms are triggered, meeting the team's requirements. Option B is incorrect because CloudFormation ChangeSets do not provide native blue/green deployment with automatic rollback based on alarms; custom Lambda functions add complexity. Option C is incorrect because CodeBuild is used for building artifacts, not deploying; manually updating the ECS service and using a Lambda for rollback is not a streamlined solution. Option D is incorrect because ECS service auto scaling handles scaling based on demand, not deployment strategies like blue/green.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
Use AWS CodeDeploy with a blue/green deployment configuration on the ECS service, and configure automatic rollback when CloudWatch alarms are breached.
Why this is correct
AWS CodeDeploy natively integrates with ECS blue/green deployments, shifting traffic between original and replacement task sets via a load balancer. Its deployment group accepts CloudWatch alarm configurations, so a breached alarm automatically triggers rollback to the original task set — satisfying the stem's requirement for alarm-driven automatic rollback.
- ✗
Use AWS CloudFormation with a ChangeSet and a custom rollback Lambda function triggered by CloudWatch alarms.
Why it's wrong here
CloudFormation ChangeSets update stack resources but do not perform ECS blue/green traffic shifting; rollback depends entirely on the custom Lambda rather than a managed deployment controller. It is tempting because CloudFormation manages infrastructure as code, and would be correct for provisioning ECS services rather than orchestrating releases.
- ✗
Use AWS CodeBuild to run a build that creates a new task definition, then update the ECS service manually, and use CloudWatch alarms to trigger a rollback via a Lambda function.
Why it's wrong here
Manually updating the ECS service bypasses CodeDeploy's blue/green traffic shifting and its native alarm-triggered rollback, so the Lambda must orchestrate rollback itself. It is tempting because CodeBuild and Lambda are familiar, and would be correct for custom deployment logic without managed blue/green orchestration.
- ✗
Use Amazon ECS service auto scaling with step scaling policies based on CloudWatch alarms.
Why it's wrong here
Auto scaling adjusts task count in response to load; it neither shifts traffic between blue and green target groups nor triggers rollback on CloudWatch alarms. It is tempting because it also consumes CloudWatch alarms, but that is for capacity management, not deployment orchestration.
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
This DOP-C02 question is part of Courseiva's 1,298-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 →
Same concept, more angles
3 more ways this is tested on DOP-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 DevOps team is designing a deployment pipeline for a microservices application on Amazon ECS using AWS CodePipeline. They want to implement a canary deployment strategy where a small percentage of traffic is routed to the new version before fully promoting it. Which AWS service or feature should they use to achieve this?
medium- A.Amazon ECS Service Auto Scaling
- ✓ B.AWS CodeDeploy with ECS blue/green deployment
- C.Amazon Route 53 weighted routing
- D.AWS App Mesh with traffic shifting
Why B: AWS CodeDeploy with ECS blue/green deployment is the correct choice because it natively supports canary traffic shifting for Amazon ECS services. When integrated with AWS CodePipeline, CodeDeploy can route a small percentage of traffic (e.g., 10%) to the new task set, monitor it with CloudWatch alarms, and then automatically shift the remaining traffic after a specified interval. This is the only option that directly provides the canary deployment lifecycle within the ECS and CodePipeline context.
Variation 2. A DevOps engineer is designing a CI/CD pipeline for a microservices application running on Amazon ECS with Fargate. The team wants to use a blue/green deployment strategy to minimize downtime. Which combination of AWS services and configurations should be used to implement this?
hard- A.Use Amazon ECS service with a rolling update deployment controller
- B.Create two separate ECS services and use Route 53 weighted routing to shift traffic
- C.Use AWS CloudFormation with a custom resource to swap target group weights
- ✓ D.Use CodeDeploy with an ECS compute platform and an Application Load Balancer
Why D: CodeDeploy with an ECS compute platform natively supports blue/green deployments for ECS services by orchestrating traffic shifting between two target groups behind an Application Load Balancer. This approach minimizes downtime by gradually routing traffic from the 'blue' (current) task set to the 'green' (new) task set, with built-in rollback capabilities and lifecycle hooks for validation.
Variation 3. A company runs a microservices architecture on Amazon ECS with Fargate launch type. Each microservice is deployed using AWS CodePipeline with a source stage from CodeCommit, a build stage in CodeBuild, and a deploy stage that updates the ECS service. The team wants to implement a blue/green deployment strategy to reduce downtime and enable quick rollbacks. Which combination of AWS services and configurations should be used?
hard- A.Use AWS CloudFormation with a 'DeploymentPreference' set to 'BlueGreen' for the ECS service.
- ✓ B.Use AWS CodeDeploy with a deployment group configured for blue/green deployment, and an Application Load Balancer (ALB) to shift traffic between the blue and green target groups.
- C.Use the ECS service's built-in rolling update with a 'minimumHealthyPercent' of 100 and 'maximumPercent' of 200.
- D.Configure the ECS service with an 'AutoScaling' policy that replaces instances gradually.
Why B: AWS CodeDeploy natively supports blue/green deployments for Amazon ECS (Fargate) by orchestrating traffic shifting between two target groups behind an Application Load Balancer (ALB). This allows the new task set (green) to be validated before production traffic is fully shifted, and enables instant rollback by reverting traffic to the original (blue) target group. CodePipeline can integrate CodeDeploy as a deploy action to automate this workflow.
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.