What should a solutions architect recommend to automate the application deployment process with the LEAST amount of operational overhead?
Configure Amazon EventBridge (Amazon CloudWatch Events) to invoke an AWS Lambda function when a new EC2 instance is launched into the Auto Scaling group. Code the Lambda function to associate the EC2 instances with the CodeDeploy deployment group.
Write a script to suspend Amazon EC2 Auto Scaling operations before the deployment of new code. When the deployment is complete, create a new AMI and configure the Auto Scaling group’s launch template to use the new AMI for new launches. Resume Amazon EC2 Auto Scaling operations.
Create a new AWS CodeBuild project that creates a new AMI that contains the new code. Configure CodeBuild to update the Auto Scaling group’s launch template to the new AMI. Run an Amazon EC2 Auto Scaling instance refresh operation.
Create a new AMI that has the CodeDeploy agent installed. Configure the Auto Scaling group’s launch template to use the new AMI. Associate the CodeDeploy deployment group with the Auto Scaling group instead of the EC2 instances.
Explanations:
Although this option could automate instance registration, it adds operational complexity by requiring a Lambda function to manage instance association with CodeDeploy, which is less efficient and introduces extra components.
This option involves manual intervention to suspend Auto Scaling, which increases operational overhead and could introduce delays, as it requires additional steps to create an AMI and resume Auto Scaling.
While creating an AMI with CodeBuild and updating the launch template is valid, it also requires a separate instance refresh operation, making it less automated and increasing operational steps.
Using an AMI with the CodeDeploy agent and associating CodeDeploy directly with the Auto Scaling group automates deployments without additional steps, reducing operational overhead significantly.