DVA-C02 Question 278
Single answerYou are tasked with deploying a new version of your application to an Amazon ECS cluster using AWS CodePipeline. The application code is stored in an AWS CodeCommit repository, and the build process uses AWS CodeBuild. The deployment should automatically roll back if the deployment fails. Which configuration will meet these requirements?
- A
Configure AWS CodePipeline with an Amazon S3 source action, AWS CodeBuild build action, and an ECS deploy action. Enable automatic rollback in the ECS service.
- B
Configure AWS CodePipeline with a CodeCommit source action, AWS CodeBuild build action, and a manual approval action before deploying to ECS.
- C
Configure AWS CodePipeline with a CodeCommit source action, AWS CodeBuild build action, and an ECS deploy action. Use an application load balancer and enable ECS deployment rollback.
- D
Configure AWS CodePipeline with a CodeCommit source action and an AWS Lambda deploy action to update the ECS service. Enable rollback by writing a custom Lambda function.
Show answer and explanation
Correct answer: C
Explanation
To deploy a new version of an application to Amazon ECS using CodePipeline, you need to set up actions for source, build, and deployment stages. Since the application code is stored in a CodeCommit repository, a CodeCommit source action is required. AWS CodeBuild facilitates building the application. For deployment, an ECS deploy action should be used along with an application load balancer, enabling ECS deployment rollback to automatically revert changes in case of failure. This configuration aligns with the requirements and minimizes complexity while leveraging native AWS capabilities.
- A. Incorrect.
This option incorrectly specifies an Amazon S3 source action, which is not relevant as the application code is stored in a CodeCommit repository. Additionally, enabling rollback in the ECS service is insufficient without proper handling in CodePipeline.
- B. Incorrect.
This option includes a manual approval action, which is not required for automatic rollback. It also does not mention using an application load balancer or enabling ECS deployment rollback, which are key to meeting the requirements.
- C. Correct.
This option correctly sets up a CodePipeline with a CodeCommit source action, AWS CodeBuild for the build process, and an ECS deploy action. It also specifies the use of an application load balancer and ECS deployment rollback, ensuring that the deployment automatically reverts in case of failure.
- D. Incorrect.
This option suggests using a Lambda deploy action, which is not the appropriate choice for deploying to ECS. Additionally, writing a custom Lambda function for rollback adds unnecessary complexity when ECS provides built-in rollback capabilities.