DOP-C02 SDLC Automation Practice Question
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?
⚠ Common exam trap
Many candidates confuse the ECS rolling update configuration (minimumHealthyPercent/maximumPercent) with a blue/green strategy, but rolling updates do not provide separate target groups or instant rollback, which are key requirements for the scenario.
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 deployment group configured for blue/green deployment, and an Application Load Balancer (ALB) to shift traffic between the blue and green target groups.
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.
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 CloudFormation with a 'DeploymentPreference' set to 'BlueGreen' for the ECS service.
Why it's wrong here
AWS CloudFormation does not have a 'DeploymentPreference' property for ECS services; the 'DeploymentPreference' attribute is used only for Auto Scaling group rolling updates in CloudFormation. ECS service updates through CloudFormation trigger a standard rolling update with the service's 'minimumHealthyPercent' and 'maximumPercent' settings, not a blue/green deployment. To achieve blue/green on ECS, you must explicitly create a CodeDeploy DeploymentGroup, an ALB with separate blue and green target groups, and an ECS service configured for the CodeDeploy controller—CloudFormation cannot orchestrate the traffic shifting by itself.
- ✓
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.
Why this is correct
AWS CodeDeploy natively supports blue/green deployments for ECS services when integrated with an Application Load Balancer. During deployment, CodeDeploy registers the new task set with a 'green' target group while the existing 'blue' task set remains registered with the original target group; the ALB listener's traffic is then shifted from blue to green using either a canary, linear, or all-at-once traffic-shifting configuration. CodeDeploy also runs lifecycle hooks (BeforeInstall, AfterInstall, etc.) and preserves the original task set for instant rollback if the deployment fails. This is the only option that provides immutable infrastructure and controlled traffic shifting, making it the correct answer.
- ✗
Use the ECS service's built-in rolling update with a 'minimumHealthyPercent' of 100 and 'maximumPercent' of 200.
Why it's wrong here
This configuration performs a standard rolling update, not a blue/green deployment. With 'maximumPercent' set to 200, ECS is allowed to start new tasks with the updated task definition while the old tasks remain running, and 'minimumHealthyPercent' of 100 ensures capacity is never below 100% during the process; however, both old and new tasks are behind the same target group, so the ALB continues to send traffic to the service as a whole, and there is no separate green target group or listener rule to shift traffic. Unlike blue/green, this approach does not enable immediate rollback to the previous version—you must initiate another deployment to revert—and there is no isolation between versions for testing before production traffic is sent to the new tasks.
- ✗
Configure the ECS service with an 'AutoScaling' policy that replaces instances gradually.
Why it's wrong here
The Amazon ECS Auto Scaling policy primarily adjusts the desired number of tasks based on CloudWatch metrics such as CPU, memory, or ALB request count; it does not deploy a new task definition or change the application version. Even if a scaling event launches new task instances, they run the current task definition, so the policy cannot gradually replace the service with a new version. Auto Scaling also lacks the ability to shift traffic between multiple versions or to rollback a failed release, because it does not orchestrate deployments or manage target groups; it simply adds or removes tasks from the existing service.
Go deeper
Related to this question
About these practice questions
This DOP-C02 question is part of Courseiva's 1,013-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 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.