1

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

Zain Ul Abideen
  • 389
  • 7
  • 25

2 Answers2

1

It depends how you setup your ASG. You can edit a version of your launch template to use as shown below:

enter image description here

Marcin
  • 215,873
  • 14
  • 235
  • 294
  • So everytime I will have to update the version manually?? – Zain Ul Abideen Apr 22 '21 at 07:36
  • @ZainUlAbideen If that's how you set it up? You can set it up to always lunch a latest version, or default version. You haven't demonstrated any settings of your ASG, I don't know how did you set it up. – Marcin Apr 22 '21 at 07:37
  • I had a running instance. I just attached it to the ASG from `actions > Instance Settings > attach to auto scaling group`. It automatically created launch configuration and the auto scaling group. – Zain Ul Abideen Apr 22 '21 at 07:39
  • @ZainUlAbideen Please be very specific in your question. Update with exact details of your launch configuration or launch template (can't use both), ASG settings, ... – Marcin Apr 22 '21 at 07:41
  • just updated the launch configuration and asg details. – Zain Ul Abideen Apr 22 '21 at 07:51
1

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

Jatin Mehrotra
  • 9,286
  • 4
  • 28
  • 67