How can a DevOps engineer meet these requirements?
Use an Application Load Balancer and an in-place deployment. Associate the Auto Scaling group with the deployment group. Use the Automatically copy Auto Scaling group option, and use CodeDeployDefault.OneAtAtime as the deployment configuration. Instruct AWS CodeDeploy to terminate the original instances in the deployment group, and use the AllowTraffic hook within appspec.yml to delete the temporary files.
Use an Application Load Balancer and a blue/green deployment. Associate the Auto Scaling group and Application Load Balancer target group with the deployment group. Use the Automatically copy Auto scaling group option, create a custom deployment configuration with minimum healthy hosts defined as 50%, and assign the configuration to the deployment group. Instruct AWS CodeDeploy to terminate the original instances in the deployment group, and use the BeforeBlockTraffic hook within appspec.yml to delete the temporary files.
Use an Application Load Balancer and a blue/green deployment. Associate the Auto Scaling group and the Application Load Balancer target group with the deployment group. Use the Automatically copy Auto Scaling group option, and use CodeDeployDefault.HalfAtAtime as the deployment configuration. Instruct AWS CodeDeploy to terminate the original instances in the deployment group, and use the BeforeAllowTraffic hook within appspec.yml to delete the temporary files.
Use an Application Load Balancer and an in-place deployment. Associate the Auto Scaling group and Application Load Balancer target group with the deployment group. Use the Automatically copy Auto Scaling group option, and use CodeDeployDefault AllatOnce as a deployment configuration. Instruct AWS CodeDeploy to terminate the original instances in the deployment group, and use the BlockTraffic hook within appspec.yml to delete the temporary files.
Explanations:
This option suggests an in-place deployment, which does not launch a new fleet of instances for a new revision as required. The CodeDeployDefault.OneAtATime configuration also does not meet the requirement for routing traffic to half of the new instances. Additionally, the AllowTraffic hook is used after traffic is rerouted, not before.
Although this option uses a blue/green deployment and meets some requirements, the BeforeBlockTraffic hook does not delete temporary files before routing traffic to the new fleet, as it operates before traffic is removed from the original instances, not before allowing traffic on the new instances.
This option uses a blue/green deployment with an Application Load Balancer, which meets all requirements: it launches a new fleet automatically, uses CodeDeployDefault.HalfAtATime to route traffic to half of the instances, and deletes temporary files before traffic is routed using the BeforeAllowTraffic hook. Original instances are also terminated as needed.
This option incorrectly uses an in-place deployment, which does not create a new fleet of instances. The CodeDeployDefault.AllAtOnce configuration does not meet the requirement of routing traffic to only half of the instances initially. Also, the BlockTraffic hook does not handle temporary file cleanup before allowing traffic.