Search code examples
amazon-web-servicesaws-auto-scaling

How to Update Auto Scaling Launch Configuration or Launch Template After Instance has been Updated


I have an EC2 instance running on AWS. It is running my application let's say Version1. I added my instance to ASG. After some days, I updated my Application to Version2. But now whenever my instance is terminated, the new instance is launched with Version1 of my application (as it is using old launch configuration). How can I get the latest version of my application when Auto Scaling Group launches new instance??

Launch Configuration Details

enter image description here

ASG Details

enter image description here


Solution

  • Based on the comments

    1. Auto scaling groups can use launch configuration or launch template.Launch template is a newer version,recommended by aws, because launch template supports versioning, so whenever you want to update your conifguration just update the version number of launch template by going to actions menu for launch template and modify version.docs of launch template.
    2. once you updated your launch template, fo to your autoscaling group edit it and under launch template choose the update version of template.
    3. in case of launch configuration if you want to update application you need to recreate launch configuration every single time.

    whenever my instance is terminated, the new instance is launched with Version1 of my application

    Yes whenever a new instance is launched it is using the old configuration of template. so modify your launch template version.

    my suggestions would be :- when you update your application create a ami of update application on that instance. and then update that ami in the new version of your template so your instance will be launched according to new ami, thus updated application