How to Migrate from AWS EC2 Launch Configurations to Launch Templates

Patrick Londa
January 6, 2023

For EC2 Auto Scaling, AWS is currently urging all customers to switch from using launch configurations to launch templates instead.

As part of this push, starting in 2023, launch configurations do not support any new Amazon EC2 instance types released after Dec. 31st, 2022. In practice, AWS could release a more cost-effective instance type that better fits your use case, but you won’t be able to take advantage of it until you migrate from launch configurations to launch templates.

In this guide, we’ll explain the basics of launch configurations and launch templates, and show the steps for migrating them over.

Launch Configurations vs. Launch Templates

Amazon EC2 Auto Scaling groups need information to guide how to launch new EC2 instances when they scale. They rely on one source of truth; either an EC2 instance (automatically converted to a launch configuration), a specified launch configuration, or a launch template. 

Launch Configurations

Launch configurations are instance configuration settings utilized by an EC2 Auto Scaling group to inform the new EC2 instances it launches. You must specify standard information when setting up a launch configuration, including the following:

  • ID of the Amazon Machine Image (AMI)
  • Instance Type
  • Key Pair
  • Security Group(s)
  • Block Device Mapping

For inspiration, you can use similar settings for previously launched EC2 instances if they match your use case. Once you create your launch configuration, you cannot make changes to it. You can only create a new one and update your Auto Scaling group to use the new one. If you do that, existing instances will not be immediately updated.

Launch Templates

Launch templates function similarly to launch configurations by specifying instance configuration information with similar information you would place in a launch configuration file. The major difference between launch configurations and launch templates is that you can set up multiple versions of a launch template.

Versioning launch templates lets you establish a subset of the complete parameter set. You can reuse these to set up other versions of the base launch template. For example, you can create a launch template with a defined base configuration without including an AMI or user data script.

After creating the launch template, you can add a new version with the AMI and user script for testing. You end up with two versions of the template. That means you can always have a base configuration for reference, then create new template versions as needed. It’s also possible to delete test template versions when they are no longer necessary.

Launch templates are recommended because you can access the latest improvements. Some Amazon EC2 Auto scaling features aren’t available when you use launch configurations. Launch templates also let you use newer generation features of Amazon EC2.

While parameters in launch templates are optional, you can’t add an AMI to one if you do not specify it when creating an Auto Scaling group. If you specify an AMI but leave out the instance type, it’s possible to add one or more when setting up your Auto Scaling group.

How to Migrate Launch Configurations to Launch Templates

Copying launch configurations to convert them to launch templates, you will need to use the AWS Console.

Migrating One Launch Configuration

Anyone currently using launch configurations can migrate them over to launch templates by copying them into the console.

  1. Open the EC2 console.
  2. Look for Auto Scaling in the navigation pane, then choose Launch Configurations.
  3. Choose the launch configuration to copy.
  4. Select Copy to launch template, Copy selected to set up a new template with the same name and options as your configuration.
  5. Add the name of your current launch configuration file or a new name in the New launch template name field. The name must be unique.
  6. Select Copy.

Migrating All Launch Configurations

Follow the steps below if you wish to move all your launch configurations to launch templates in the console:

  1. Open the EC2 console.
  2. Look for Auto Scaling in the navigation pane, then choose Launch Configurations.
  3. Choose the launch configuration to copy.
  4. Select Copy to launch template, Copy all to copy all your configurations within the current Region to a new launch template named after your configuration.
  5. Select Copy.

Updating Auto Scaling Groups to Use Launch Templates

Using the AWS Console:

  1. Navigate to the AWS EC2 console, open the navigation pane, and select Auto Scaling Groups.
  2. Click on the check box associated with the Auto Scaling group you want to update.
  3. In the Details tab, choose Launch configuration, then click Edit.
  4. Select Switch to launch template, then select the appropriate launch template.
  5. You’ll need to select a Version for the launch template. You can customize whether the Auto Scaling group uses a default version when it scales out, or uses the latest version.
  6. Click Update to apply the changes.

Using the AWS CLI:

You can run this update-auto-scaling-group command:

aws autoscaling update-auto-scaling-group
--auto-scaling-group-name <value>
--launch-template <value>

An Auto Scaling group cannot have both a launch configuration and launch template parameter set. To update your Auto Scaling group to use a launch template instead of a launch configuration, you can include a launch template value in this command, like in this example:

aws autoscaling update-auto-scaling-group
    --auto-scaling-group-name my-asg
    --launch-template LaunchTemplateName=my-template-for-auto-scaling,Version='2'

Once you’ve migrated your Auto Scaling groups to use launch templates instead of launch configurations, you should stop creating new launch configurations and only create launch templates and new versions.

Replacing Launch Configurations Automatically with Blink

If you have several Auto Scaling groups, making these updates can be manual and time-consuming. You also can’t ensure that new launch configurations are not created and utilized in your AWS EC2 Auto Scaling groups.

With Blink, you can use a no-code automation to quickly identify Auto Scaling groups that are using launch configurations, convert those launch configurations to launch templates, and update the groups accordingly. You can also set up checks to detect new launch configurations and notify owners that they should use launch templates instead.

Create your free Blink account and migrate fully to launch templates today.

Simplify your cloud operations Sign up for Blink today

Transform your cloud operations today with a library of purpose-built DevOps and SecOps playbooks and hundreds of integrations.

Sign Up
Back to Blog

How to Migrate from AWS EC2 Launch Configurations to Launch Templates

Starting in 2023, AWS launch configurations are no longer supporting newly-released EC2 instance types. In this guide, we'll show you how to migrate your launch configurations to launch templates.

aws-logo

For EC2 Auto Scaling, AWS is currently urging all customers to switch from using launch configurations to launch templates instead.

As part of this push, starting in 2023, launch configurations do not support any new Amazon EC2 instance types released after Dec. 31st, 2022. In practice, AWS could release a more cost-effective instance type that better fits your use case, but you won’t be able to take advantage of it until you migrate from launch configurations to launch templates.

In this guide, we’ll explain the basics of launch configurations and launch templates, and show the steps for migrating them over.

Launch Configurations vs. Launch Templates

Amazon EC2 Auto Scaling groups need information to guide how to launch new EC2 instances when they scale. They rely on one source of truth; either an EC2 instance (automatically converted to a launch configuration), a specified launch configuration, or a launch template. 

Launch Configurations

Launch configurations are instance configuration settings utilized by an EC2 Auto Scaling group to inform the new EC2 instances it launches. You must specify standard information when setting up a launch configuration, including the following:

  • ID of the Amazon Machine Image (AMI)
  • Instance Type
  • Key Pair
  • Security Group(s)
  • Block Device Mapping

For inspiration, you can use similar settings for previously launched EC2 instances if they match your use case. Once you create your launch configuration, you cannot make changes to it. You can only create a new one and update your Auto Scaling group to use the new one. If you do that, existing instances will not be immediately updated.

Launch Templates

Launch templates function similarly to launch configurations by specifying instance configuration information with similar information you would place in a launch configuration file. The major difference between launch configurations and launch templates is that you can set up multiple versions of a launch template.

Versioning launch templates lets you establish a subset of the complete parameter set. You can reuse these to set up other versions of the base launch template. For example, you can create a launch template with a defined base configuration without including an AMI or user data script.

After creating the launch template, you can add a new version with the AMI and user script for testing. You end up with two versions of the template. That means you can always have a base configuration for reference, then create new template versions as needed. It’s also possible to delete test template versions when they are no longer necessary.

Launch templates are recommended because you can access the latest improvements. Some Amazon EC2 Auto scaling features aren’t available when you use launch configurations. Launch templates also let you use newer generation features of Amazon EC2.

While parameters in launch templates are optional, you can’t add an AMI to one if you do not specify it when creating an Auto Scaling group. If you specify an AMI but leave out the instance type, it’s possible to add one or more when setting up your Auto Scaling group.

How to Migrate Launch Configurations to Launch Templates

Copying launch configurations to convert them to launch templates, you will need to use the AWS Console.

Migrating One Launch Configuration

Anyone currently using launch configurations can migrate them over to launch templates by copying them into the console.

  1. Open the EC2 console.
  2. Look for Auto Scaling in the navigation pane, then choose Launch Configurations.
  3. Choose the launch configuration to copy.
  4. Select Copy to launch template, Copy selected to set up a new template with the same name and options as your configuration.
  5. Add the name of your current launch configuration file or a new name in the New launch template name field. The name must be unique.
  6. Select Copy.

Migrating All Launch Configurations

Follow the steps below if you wish to move all your launch configurations to launch templates in the console:

  1. Open the EC2 console.
  2. Look for Auto Scaling in the navigation pane, then choose Launch Configurations.
  3. Choose the launch configuration to copy.
  4. Select Copy to launch template, Copy all to copy all your configurations within the current Region to a new launch template named after your configuration.
  5. Select Copy.

Updating Auto Scaling Groups to Use Launch Templates

Using the AWS Console:

  1. Navigate to the AWS EC2 console, open the navigation pane, and select Auto Scaling Groups.
  2. Click on the check box associated with the Auto Scaling group you want to update.
  3. In the Details tab, choose Launch configuration, then click Edit.
  4. Select Switch to launch template, then select the appropriate launch template.
  5. You’ll need to select a Version for the launch template. You can customize whether the Auto Scaling group uses a default version when it scales out, or uses the latest version.
  6. Click Update to apply the changes.

Using the AWS CLI:

You can run this update-auto-scaling-group command:

aws autoscaling update-auto-scaling-group
--auto-scaling-group-name <value>
--launch-template <value>

An Auto Scaling group cannot have both a launch configuration and launch template parameter set. To update your Auto Scaling group to use a launch template instead of a launch configuration, you can include a launch template value in this command, like in this example:

aws autoscaling update-auto-scaling-group
    --auto-scaling-group-name my-asg
    --launch-template LaunchTemplateName=my-template-for-auto-scaling,Version='2'

Once you’ve migrated your Auto Scaling groups to use launch templates instead of launch configurations, you should stop creating new launch configurations and only create launch templates and new versions.

Replacing Launch Configurations Automatically with Blink

If you have several Auto Scaling groups, making these updates can be manual and time-consuming. You also can’t ensure that new launch configurations are not created and utilized in your AWS EC2 Auto Scaling groups.

With Blink, you can use a no-code automation to quickly identify Auto Scaling groups that are using launch configurations, convert those launch configurations to launch templates, and update the groups accordingly. You can also set up checks to detect new launch configurations and notify owners that they should use launch templates instead.

Create your free Blink account and migrate fully to launch templates today.

Simplify your cloud operations

Sign up for Blink today

Transform your cloud operations today with a library of purpose-built DevOps and SecOps playbooks and hundreds of integrations.

Sign up