Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a web application setup with a load balancer and auto scaling group to manage scaling. The source code is in a git repository so I don't have to update the images when the code changes, but occasionally the environment changes so we create a new image. Then that image needs to be cycled into the auto scaling group.

Is there a way to cycle the images automatically? Right now I schedule a scale up and scale down action which gets rid of the old instances.

share|improve this question
It is probably more efficient if, after you create your new launch config and update your autoscaling group, you mark each instance as unhealthy (e.g. using as-set-instance-health), so that autoscaling simply replaces it with a new instance. – cyberx86 Apr 30 '12 at 20:10

I'd like to suggest "AWS-HA-Release" to do this - the way AWS-HA-Release works:

  1. If the current autoscaling group and ELB report 5 instances that are healthy,
  2. AWS-HA-Release brings a new instance into production and waits for the ELB to identify it as healthy (bring the total number of healthy instances to 6)
  3. Removes an old instance (total down to 5)
  4. Brings another instance into service (total to 6)
  5. Removes an old instance (total down to 5)
  6. and so on until all instances have been replaced

In this case, you can ship new code or new AMI versions without downtime and have the benefit of entirely new instances. The AWS-HA-Release tool is available at

share|improve this answer

the way i manage this scenario is to use the UpdatePolicy feature of the AWS::AutoScaling::AutoScalingGroup object in cloud formation. when the cloud formation stack is updated it will manage the cycling of the instances.

some references.

share|improve this answer
Thanks a tonne @graeme. I had no idea Cloudformation offered this functionality. – AJB Aug 27 '15 at 7:52

Also have a look at the Netflix Asgard tool that is now open source. Not only can it set up Auto Scaling Groups, it can also perform rolling releases of new AMI images for a group of instances.

share|improve this answer
You mean "Netflix Asgard" – user99751 Nov 17 '12 at 15:08
Yes - fixed - thanks – platforms Nov 17 '12 at 15:09

There's not actually a really good way of doing it to be honest. The best way I found to do it is to put a version in the ASG name. Any time I update the AMI I create a new ASG + Launch Config with the new version so it does not conflict with the other group. Then I terminate all the instances in the old group.

If a more fault tolerant deployment is required I recommend adding another step by involving the creation of a new loadbalancer as well. This allows you to have both ASG isolated from each other. It also allows you to have a "Staging" area to test your changes one last time before updating. Then when you're ready to switch you update the DNS records and terminate all the instances in the old group.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.