This guide shows how to update the instances in an autoscaling environment using EZAutoScaling.



There are two ways to keep the contents of your AutoScaled EC2 instances fresh. Why would you want to do this? Here is an example: you update code that you are running and you would like existing EC2 instances and new-to-be-spawned EC2 instances to use your new code. The two ways are:
  1. Update the AMI template that the AutoScaling Group uses, and then force each live EC2 instance to update itself with the new AMI template. New EC2 instances will use the updated AMI template. The steps to do this are on this page, below.
  2. Write a start up script that will run when a new EC2 instance spawns. The start up script can for example grab your latest code and deploy it to itself. This is done by using EC2 User-Data and is described in our guide here.

Pre-requisites



Update an AutoScaling Group with newer EC2 instances

  1. Log into EZAutoScaling

  2. Go to the Auto Scaling Groups page
    AutoScaling Groups
  3. Click "View" on the Autoscaling Group that you want to update
    View AutoScaling Group
  4. The Autoscaling Group row will turn yellow and the instances of that group will appear below
    AutoScaling Group EC2 instances
  5. Click on the button "Update the Instances in this Auto Scaling Group"

  6. Select the AMI for the new EC2 instances. As mentioned in the pre-requisites if you have an updated EC2 instance already,
    then you must create an AMI from it in the AWS Management Console.

    By updating the AMI you are actually creating a new launch configuration. You can use the automatically generated name for the new launch configuration, or you can change the name. You can also edit other details of the launch configuration by clicking on the "Click here to add more details" text. This is entirely optional, the settings used will be the same as the autoscaling group's current launch configuration.
    Update EC2 Instances
  7. You have 3 options for updating the EC2 instances:
    Update EC2 Instances Options
    • Update all EC2 instances now: This will shut down all the instances in the auto scaling group immediately and will re-create them with the new AMI.
    • Update only newly spawned EC2 instances: This will keep the current instances running and will not touch them. New instances that are started up in this auto scaling group will use the new AMI.
    • Update EC2 instances manually one by one: This will not shut down and re-create any EC2 instances. You will have to go back to the Auto Scaling Groups screen and update each instance one by one by clicking the "Update Instance to Latest AMI" link. When you click on that link the EC2 instance will shut down and be re-created with the new AMI.
      Newly spawned instances will use the new AMI.
      Update EC2 instance in autoscaling group manually



Sign Up

Back to How To Guides


comments powered by Disqus

Back to top

Copyright © EZAutoScaling Inc. About · Contact · Privacy · Terms

"Amazon Web Services", "AWS", "Auto Scaling", "EC2", "CloudWatch" are trademarks of Amazon.com, Inc.