DOP-C02 Question 239
Single answerYou are managing a CI/CD pipeline for a web application hosted on Amazon ECS using Fargate. The development team has requested a solution to automatically roll back deployments if more than 20% of tasks fail during a deployment. Which approach should you take to implement this requirement?
- A
Configure an AWS CodeDeploy deployment group with ECS as the target, and enable the 'Rollback on Alarm' feature with a CloudWatch alarm monitoring task failures.
- B
Use AWS CodePipeline with a manual approval step to verify deployments and roll back if tasks fail.
- C
Enable ECS deployment circuit breaker in the service deployment configuration to automatically revert failed deployments.
- D
Create a Lambda function to monitor task failures and integrate it with the ECS service to trigger rollbacks manually.
Show answer and explanation
Correct answer: C
Explanation
Amazon ECS deployment circuit breaker is a feature that provides automatic rollback capabilities for failed deployments. By enabling this feature in the ECS service deployment configuration, you can ensure that the system will automatically roll back the deployment if it detects that more than a specified percentage of tasks (e.g., 20%) fail. This approach is efficient, requires minimal setup, and is specifically designed for ECS workloads, making it the best solution for the scenario.
- A. Incorrect.
This option is not correct because while AWS CodeDeploy supports rollback on alarms, this setup is more complex than needed for ECS services using Fargate. Additionally, the 'Rollback on Alarm' feature would require a CloudWatch alarm and is not natively tied to the ECS deployment circuit breaker.
- B. Incorrect.
This option is not correct because a manual approval step would require human intervention and does not provide an automatic rollback mechanism based on task failures.
- C. Correct.
This is the correct option because ECS deployment circuit breaker is a native feature that automatically rolls back the deployment if a specified percentage of tasks fail. It is well-suited for ECS services running on Fargate.
- D. Incorrect.
This option is not correct because while a Lambda function could monitor task failures, implementing a custom rollback mechanism is unnecessary when ECS already provides a built-in deployment circuit breaker feature.