The other day I noticed that some our instances were coming up with package install issues but when I ran the script on a fresh test instance everything worked fine.
After looking into the differences between my test instance and the autoscaling group instances I noticed that the AMI (Operating system) was different.
In order to change this I needed to get the AutoScaling Group Command Line Tools and do a number of things.
First I needed to create a new launch config. A launch config tells an autoscaling group what size EC2 instance to run and what ami to use. In order to see how your current launch config is configured you can run:
./as-describe-launch-configs your-launch-config --show-long
I then noticed my AMI was an old Debian image.
I wanted to use Ubuntu for this service. I ran:
./as-create-launch-config your-new-launch-config --image-id ami-3c994355 --instance-type m1.small --key post-svn-rebuild --user-data-file ~/user-data-bootup-script.sh
your-new-launch-config is the name of the launch config I am creating. ~/user-data-bootup-script.sh Is the script that is ran when a new machine is brought up. We use this to bootstrap our instance deployment scripts.
I then updated our autoscaling group to use the new launch config and killed off the old instance (creating a new instance to take its place)
./as-update-auto-scaling-group your-autoscaling-group --launch-configuration your-new-launch-config ./as-terminate-instance-in-auto-scaling-group i-894ffff4 --no-decrement-desired-capacity