Starting on October 1, 2024, new AWS users will no longer be able to create launch configurations using the console, API, or CloudFormation due to the end of life for Auto Scaling launch configurations. All users are encouraged to migrate to launch templates. This article explains the key differences between launch configurations and launch templates, highlights the benefits of using launch templates, and provides a step-by-step guide on how to perform the migration.
Launch Configuration acts as an instance template used by an Auto Scaling group to launch EC2 instances. Launch Configuration specifies information for the instances such as ID of the Amazon Machine Image (AMI), the instance type, a key pair, one or more security groups, and a block device mapping. It’s important to note that once Launch Configuration is created, it cannot be modified. Moreover, Launch Configuration lacks versioning, making it impossible to maintain different versions for different purposes.
In terms of functionality, Launch Template is similar to Launch Configuration – its purpose is to specify instance configuration information. It also specifies the ID of the Amazon Machine Image (AMI), the instance type, a key pair, security groups, and other parameters used to launch EC2 instances. However, Launch Template, unlike Launch Configuration, allows having multiple versions of a launch template.
Using Launch Templates over Launch Configuration is recommended by AWS. Using Launch Templates offers numerous Amazon EC2 Auto Scaling features, which are not available when using Launch Configurations, for instance:
- Systems Manager parameters (AMI ID),
- the current generation of EBS Provisioned IOPS volumes (io2),
- EBS volume tagging,
- T2 Unlimited instances,
- Capacity Reservations,
- Capacity Blocks,
- and Dedicated Hosts, among others.
Before migrating to Launch Templates, it is necessary to check permissions to work with it. The IAM permissions required for working with Amazon EC2 Launch Templates include::
- ec2:CreateLaunchTemplate (it is recommended to use tags to control access to the launch templates)
- ec2:DescribeLaunchTemplates
- ec2:DescribeLaunchTemplateVersions
- ec2:DeleteLaunchTemplate (Use caution when giving principals permission to delete a resource)
- Control versioning permissions
- Control access to tags on launch templates
The first step is to identify Auto Scaling groups that use launch configuration. To do so, run the following command using AWS CLI. Replace REGION with AWS Region used.
aws autoscaling describe-auto-scaling-groups –region REGION –query ‘AutoScalingGroups[?LaunchConfigurationName!=`null`]’
The next step is to copy a Launch Configuration to a Launch Template. If multiple Launch Configurations are copied, then it results in identically named launch templates. Copying them one by one allows changing the name given to a Launch Template. It’s important to note that the copying feature is available only from the console.
Once this is done Auto Scaling group can be updated to use a launch template. This can be done using AWS CLI with the command below. Replace my-asg with the appropriate Auto Scaling group name.
aws autoscaling update-auto-scaling-group –auto-scaling-group-name my-asg \ –launch-template LaunchTemplateName=my-template-for-auto-scaling,Version=’1′
The last step is to replace the instances. The existing instances are not affected, only new instances will use the new Launch Template. To update the existing instances, use instance refresh to replace the instances in the Auto Scaling group.
If you struggle with migrating your Launch Configuration to Launch Template, feel free to contact us.