DOP-C02 Question 63
Select 3Your company has a CI/CD pipeline built using AWS CodePipeline, AWS CodeBuild, and AWS CodeDeploy. During the deployment phase, you notice that deployments to an EC2 Auto Scaling group occasionally fail due to instances being in an unhealthy state. You want to ensure that CodeDeploy only deploys to healthy instances and rolls back deployments automatically if a failure occurs. Which combination of actions should you take to achieve this?
- A
Enable CodeDeploy's deployment rollback on failure setting.
- B
Configure the Auto Scaling group with an Elastic Load Balancer (ELB) and enable health checks.
- C
Modify the CodeBuild project to include a post-build validation script.
- D
Use a CodeDeploy deployment configuration that includes minimum healthy host thresholds.
- E
Enable detailed monitoring for EC2 instances in the Auto Scaling group.
Show answer and explanation
Correct answers: A, B, D
Explanation
To ensure that deployments are reliable and resilient, you need to take steps that directly address the health of instances and manage failures. Enabling CodeDeploy's rollback on failure, setting up health checks using an ELB, and defining deployment configurations with minimum healthy host thresholds are critical actions. These configurations ensure that deployments only target healthy instances and automatically recover from failures, minimizing downtime and impact on users.
- A. Correct.
Enabling CodeDeploy's deployment rollback on failure ensures that if an issue occurs during deployment, the system automatically reverts to the previous version, minimizing downtime.
- B. Correct.
Configuring the Auto Scaling group with an ELB and health checks ensures that only healthy instances are included in the deployment and can serve traffic.
- C. Incorrect.
Modifying the CodeBuild project with a post-build validation script is not directly related to ensuring healthy instances during deployment. This step is more relevant to build validations.
- D. Correct.
Using a CodeDeploy deployment configuration with minimum healthy host thresholds ensures that a certain percentage of instances remain healthy during deployments, reducing the risk of total failure.
- E. Incorrect.
Enabling detailed monitoring for EC2 instances provides more metrics but does not directly influence the health of instances during deployment or trigger rollbacks.