Q60 — AWS DOP-C02 Ch.3
Question 60 of 100 | ← Chapter 3
A company wants to replace its current bash deployment scripts with AWS developer tools. Currently, it deploys a LAMP application to a set of Amazon EC2 instances behind an Application Load Balancer (ALB). During deployment, the company runs unit tests on the submitted application, stops and restarts services, deregisters and re-registers instances with the load balancer, and updates file permissions. The company wants to retain identical deployment functionality by adopting AWS services.
- A. Use AWS CodeBuild to test the application. Use bash scripts invoked by AWS CodeDeploy’s appspec.yml file to restart services and deregister/register instances with the ALB. Use appspec.yml to update file permissions without custom scripts.
- B. Use AWS CodePipeline to move the application from an AWS CodeCommit repository to AWS CodeDeploy. Use CodeDeploy’s deployment group to test the application, deregister/re-register ALB instances, and restart services. Use appspec.yml to update permissions without custom scripts.
- C. Use AWS CodePipeline to move the application source code from an AWS CodeCommit repository to AWS CodeDeploy. Use CodeDeploy to test the application. Use CodeDeploy’s appspec.yml file to restart services and update permissions without custom scripts. Use AWS CodeBuild to deregister and re-register instances with the ALB.
- D. Use AWS CodePipeline to trigger AWS CodeBuild to test the application. Use bash scripts invoked by AWS CodeDeploy’s appspec.yml file to restart services. Deregister and re-register instances in the ALB within the AWS CodeDeploy deployment group. Update appspec.yml to update file permissions without custom scripts. ✓
Correct Answer: D. Use AWS CodePipeline to trigger AWS CodeBuild to test the application. Use bash scripts invoked by AWS CodeDeploy’s appspec.yml file to restart services. Deregister and re-register instances in the ALB within the AWS CodeDeploy deployment group. Update appspec.yml to update file permissions without custom scripts.
Explanation
The solution must satisfy four core requirements: automated unit testing, service restart, ALB instance registration/deregistration, and file permission updates. AWS CodePipeline orchestrates the workflow; AWS CodeBuild is the appropriate, managed service for unit testing (CodeDeploy does not natively support unit testing); AWS CodeDeploy handles service management and permission updates via appspec.yml hooks—and supports invoking custom bash scripts for ALB registration/deregistration. Option D correctly separates concerns: CodeBuild for testing, CodeDeploy for orchestration, ALB operations via script hooks, and permissions via declarative appspec.yml—fully replacing bash logic with AWS-native, maintainable tooling.