So I know I can go into the AWS console and one by one edit the user-data, but I want to run the same user-data on all instances in the same auto scaling group. Is this possible?
-
Are these instances already launched or is this for future instances? – Chris Williams Sep 17 '20 at 18:47
-
they are already launched, but I could do with either way. – mastercool Sep 17 '20 at 18:54
1 Answers
When you launch an autoscaling group you have the choice over using a launch template or a launch configuration which defines the settings for the instances that are launched (such as instance class, AMI to use etc).
IF you're using a launch template you can create a new version, by doing this you can update the parameters (including the User Data found under the Advanced section). Alternatively you can create a new template and fill it out with the parameters as required.
If you're using a launch configuration you will need to create a new launch configuration as it does not support versioning. During the "Configure details" stage of the wizard you will be provided with a textarea to specify your user data as you would for a standard EC2.
Once you have made one of the changes above you will need to update your autoscaling group to use these changes. Additionally you will need to terminate any old instances, to allow newer instances to replace them with the new user data.

- 32,215
- 4
- 30
- 68
-
This is what I was thinking to do too but for some reason I can’t find the Amazon Linux 2 AMI in the AMI list when I go to create the launch configuration. I’ve seen it there before but now the list looks completely different. – mastercool Sep 17 '20 at 19:08
-
Are you able to paste in the AMI id if you get it from the standard launch instance interface? – Chris Williams Sep 17 '20 at 19:10
-
Yes I can. It turns out I was using launch configurations instead of launch templates. – mastercool Sep 17 '20 at 19:39
-
-
Yep the user data in the launch template was just what I needed. Accepting your answer. Thanks! – mastercool Sep 17 '20 at 19:45
-