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.

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.