Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thattommyhall/c12d36c7216b5aa20a966381470288f2 to your computer and use it in GitHub Desktop.
Save thattommyhall/c12d36c7216b5aa20a966381470288f2 to your computer and use it in GitHub Desktop.

Preparing the non-active autoscaling group

We suspend autoscaling as we want it to have the same number of machines as the active one.

aws autoscaling suspend-processes --auto-scaling-group-name "api-sandpit-blue" --scaling-processes Terminate
aws autoscaling set-desired-capacity --auto-scaling-group-name "api-sandpit-blue" --desired-capacity <N>

You can smoke-test the api-sandpit-blue ELB now

Adding the non-active ASG

aws autoscaling attach-load-balancers --auto-scaling-group-name "api-sandpit-blue" --load-balancer-names "api-sandpit"

Removing the old ASG

Obviously only when the new one is online in the api-sandpit ELB

aws autoscaling detach-load-balancers --auto-scaling-group-name "api-sandpit-blue" --load-balancer-names "api-sandpit"

Scale down the non-active ASG

As we have the ASG created in terraform we cannot set capacity to 0 unfortunately

aws autoscaling set-desired-capacity --auto-scaling-group-name "api-sandpit-green" --desired-capacity 1

Resume autoscaling process on the newly active ASG

aws autoscaling resume-processes  --auto-scaling-group-name "api-sandpit-blue" --scaling-processes Terminate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment