amazon web services - Auto Scaling Group launch config changes -


i wonder if there simple way or best practices on how ensure instances within autoscaling group have been launched current launch-configuration of autoscaling group.

to give example, imagine auto-scaling group called www-asg 4 desired instances running webservers behind elb. want change ami or userdata used start instances of auto-scaling group. create new launch configuration www-cfg-v2 , update www-asg use that.

# create new launch config as-create-launch-config www-cfg-v2 \     --image-id 'ami-xxxxxxxx' --instance-type m1.small \     --group web,asg-www --user-data "..."  # update asg use new config as-update-auto-scaling-group www-asg --launch-configuration www-cfg-v2 

by 4 running instances still use old launch configuration. wonder if there simple way of replacing running instances new instances enforce new configuration, but ensure minimum of instances kept running.

my current way of achieving follows..

  1. save list of current running instances given autoscaling group
  2. temporarily increase number of desired instances +1
  3. wait new instance available
  4. terminate 1 instance list via

    as-terminate-instance-in-auto-scaling-group i-xxxx \     --no-decrement-desired-capacity --force 
  5. wait replacement instance available

  6. if more 1 instance left repeat 4.
  7. terminate last instance list via

    as-terminate-instance-in-auto-scaling-group i-xxxx \     --decrement-desired-capacity --force 
  8. done, instances should run same launch config

i have automated procedure feel there must better way of achieving same goal. knows better more efficient way?

mathias

also posted question in official aws ec2 forum.

this isn't lot different, could:

  1. create new lc
  2. create new asg using new lc
  3. scale down old asg
  4. delete old asg , lc

i deployments way, , it's in experience roll 1 asg another, rather having jump , forth. noted, it's not huge difference.

it might worth looking at: https://github.com/netflix/asgard , netflix oss tool managing autoscaling groups. ended not using it, it's pretty interesting nonetheless.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -

php - Accessing static methods using newly created $obj or using class Name -