Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
add comment

3 Answers

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 http://awsmissingtools.com.

share|improve this answer
add comment

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
add comment

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" –  JustinY Nov 17 '12 at 15:08
    
Yes - fixed - thanks –  platforms Nov 17 '12 at 15:09
add comment

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.