Update Launch configuration in Auto Scaling

31 / Jan / 2014 by Tejprakash Sharma 0 comments

Auto Scaling is a service provided by Amazon Web Services which allows you to scale up or down your infrastructure horizontally by automatically adding or removing EC2 instances based on user-defined policies, health status checks or schedule. Lets start with some terminology before diving into specifics of auto scaling.

Launch Configuration: - In launch config, you specify the template that auto scaling uses to launch EC2 instances.  In the below mentioned command you define the launch config name, AMI, instance type and the security group for the EC2 instances.

Auto Scaling Group : Auto Scaling Group is the core part of auto scaling service. Here, you can define settings like minimum, maximum and desired number of EC2 instances for an auto scaling group.

By default, Auto Scaling does not facilitate the option of update launch configuration. But if you want to update the AMI, User data or Instance type, you need to create a new launch configuration and then update the same into the Auto Scaling group.

Let take a use case to update AMI in Auto Scaling:

Create a new launch configuration with all old options and only update AMI-id in it.

aws autoscaling create-launch-configuration --launch-configuration-name "new-launch-configuration-name" --image-id "new-AMI-id"

Update Auto Scaling group and pass this new launch configuration name.

aws autoscaling update-auto-scaling-group --auto-scaling-group-name "current-autoscaling-group-name" --launch-configuration-name "new-launch-configuration-name"

Delete old launch configuration.

aws autoscaling delete-launch-configuration --launch-configuration-name "old-launch-configuration-name"

Now all the new instances launched by the Auto Scaling will be according to the new launch configuration.

To know more about Auto Scaling, you can visit our Beginners Guide to Auto Scaling.

I hope this blog will help you update launch configuration in Auto Scaling.

FOUND THIS USEFUL? SHARE IT

Leave a comment -