4
votes

I have created Auto scaling group in AWS using a customized AMI. Now to rollout my new code I need to either update all instances running but then if a new instance comes up it won't be updated. So, I need a way to update AMI. One way could be creating new AMI and Autoscaling group.

Thanks in advance.

1

1 Answers

9
votes

This is one way to go about it:

  1. Spin up a stand-alone instance using the AMI
  2. Make changes
  3. Stop instance
  4. Create new AMI from this instance
  5. Create a new Launch Configuration that uses the new AMI
  6. Update the Autoscaling Group to use the new Launch Configuration
  7. Slowly terminate the old instances in the Autoscaling Group, and let them be automatically replaced with instances using the new AMI

Of course all this is a pain to deal with manually every time you need to make a change. Elastic Beanstalk and CloudFormat both provide mechanisms to deal with this in a more automated way.

If you are just changing the code you are deploying to your servers, then there are other ways to handle this, such as using AWS CodeDeploy. You could also update the running servers in some automated or manual fashion, and configure the AMI such that any new instances that are created will go get the latest code on startup.