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
aws autoscaling attach-load-balancers --auto-scaling-group-name "api-sandpit-blue" --load-balancer-names "api-sandpit"
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"
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
aws autoscaling resume-processes --auto-scaling-group-name "api-sandpit-blue" --scaling-processes Terminate