Q64 — AWS DOP-C02 Ch.3

Question 64 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 starts 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

Unit testing must be performed in an isolated, ephemeral environment—AWS CodeBuild is purpose-built for this, whereas CodeDeploy runs on target instances and is not designed for unit testing. ALB instance registration/deregistration requires interaction with the ALB API and is best handled via custom bash scripts invoked through CodeDeploy lifecycle hooks (e.g., BeforeInstall or AfterInstall). File permissions can be declaratively set in appspec.yml. CodePipeline orchestrates the entire flow: triggering CodeBuild for testing, then CodeDeploy for deployment and instance management. Option D correctly assigns responsibilities: CodeBuild for testing, CodeDeploy for deployment orchestration and ALB operations via scripts, and appspec.yml for permissions—fully replacing bash logic with AWS-native, maintainable components.