QuestionQ85

VerifiedSDLC Automation

A company uses AWS CodeDeploy to automate software deployments. The deployment must satisfy these requirements:

  • Several instances must remain available to serve traffic during deployment. Traffic must be balanced across those instances, and the instances must automatically recover if a failure occurs.
  • A new fleet of instances must be automatically launched to deploy a new revision, without manual provisioning.
  • Traffic must be rerouted to the new environment for half of the new instances at a time. The deployment must succeed if traffic is rerouted to at least half of the instances; otherwise, it must fail.
  • Before traffic is routed to the new fleet of instances, temporary files created during the deployment process must be deleted.
  • At the completion of a successful deployment, the original instances in the deployment group must be deleted immediately to reduce costs.

How can a DevOps engineer fulfill these requirements?

Explanation

An EC2 blue/green deployment that automatically copies the Auto Scaling group creates a replacement fleet while the original fleet continues serving load-balanced traffic. CodeDeployDefault.HalfAtATime routes traffic to up to half of the replacement instances at a time and succeeds if rerouting succeeds for at least half. The BeforeAllowTraffic AppSpec lifecycle hook runs on replacement instances before they are registered with the load balancer, making it the proper point to remove temporary deployment files. Configuring termination of the original instances with no wait period removes the old fleet immediately after successful traffic rerouting. Working with deployment configurations in CodeDeploy AppSpec 'hooks' section

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!