Q63 — AWS SAP-C02 Ch.2

Question 63 of 75 | ← Chapter 2

Q213. A company has an application that runs on Amazon EC2instances in an Amazon EC2 Auto Scaling group. The company uses AWS CodePipeline to deploy the application. The instances that run in the Auto Scaling group are constantly changing because of scaling events. When the company deploys new application code versions, the company installs the AWS CodeDeploy agent on any new target EC2 instances and associates the instances with the CodeDeploy deployment group. The application is set to go live within the next 24 hours. What should a solutions architect recommend to automate the application deployment process with the LEAST amount of operational overhead?

Correct Answer: D. Create a new AMI that has the CodeDeploy agent installed Configure the Auto Scaling group's launch template to use the new AM1 Associate the CodeDeploy deployment group with the Auto Scaling group instead of the EC2 instances.

Explanation

Option A suggests configuring Amazon EventBridge (Amazon CloudWatch Events) to invoke an AWS Lambda function when a new EC2 instance is launched into the Auto Scaling group. This approach adds complexity to the deployment process and increases the operational overhead. Option B suggests suspending Amazon EC2 Auto Scaling operations before the deployment of new code, creating a new AMI, and configuring the Auto Scaling group's launch template to use the new AMI for new launches. This approach is not suitable for environments where scaling events are frequent, and manual intervention would be required each time new code is deployed. Option C suggests creating a new AWS CodeBuild project that creates a new AMI that contains the new code and configuring CodeBuild to update the Auto Scaling group's launch template to the new AMI. This approach requires additional management overhead and may not be suitable for environments with frequent scaling events. Therefore, option D provides the most suitable solution by creating a new AMI that has the CodeDeploy agent installed, configuring the Auto Scaling group's launch template to use the new AMI, and associating the CodeDeploy deployment group with the Auto Scaling group instead of the EC2 instances. This approach streamlines the deployment process, reduces operational overhead, and ensures that all newly launched instances have the CodeDeploy agent pre-installed and associated with the correct deployment group.