Dat Ho
Dat Ho

Reputation: 1085

What is the difference between AWS ASG Launch Templates and Launch Configurations?

I'm getting confused when using Terraform to provision an auto-scaling group. Should I use launch configuration or launch template for EC2 properties, such as which AMI, instance types, ...?

I don't know what the difference is between them, which we should use and why they exist?

Upvotes: 81

Views: 52545

Answers (5)

Seth E
Seth E

Reputation: 1115

Latest guidance from AWS Docs

Launch configurations no longer add support for new Amazon EC2 instance types that are released after December 31, 2022. In addition, any new accounts created on or after June 1, 2023 will not have the option to create new launch configurations through the console. However, API, CLI, and CloudFormation access will be available to new accounts created between June 1, 2023 and December 31, 2023 to support customers with automation use cases. New accounts created on or after January 1, 2024 will not be able to create new launch configurations by using the console, API, CLI, and CloudFormation. For information about migrating your Auto Scaling groups to launch templates, see Migrate to launch templates.

Upvotes: 0

Jim Tough
Jim Tough

Reputation: 15239

May 2023... this banner message appears in the "Launch Configurations" section of the EC2 service in AWS Management Console:

Recommendation to not use launch configurations

Amazon EC2 Auto Scaling no longer adds support for new EC2 features to launch configurations and will stop supporting new EC2 instances types after December 31, 2022. We recommend that customers using launch configurations migrate to launch templates. For more information, see the documentation

You can use Launch Templates to power auto-scaling groups (not sure if that was true in the past)

Upvotes: 3

vijayraj34
vijayraj34

Reputation: 2415


Both are used in instance creation in ASG.


Launch Configuration(Legacy): Must be recreated every time because modification is not allowed.

Launch Template (Recommended By AWS) :

  1. Allows to edit and update.
  2. Maintains versions.
  3. Can use T2 unlimited burst feature.
  4. Allow provisioning using both On-demand and Spot Instances.
  5. Creation of parameter subsets.(Partial configuration for reuse and inheritance)
  6. Can also be used to launch a standalone instance using AWS Console, SDK and CLI.

I hope the above answer clarifies the doubt.

Upvotes: 28

KnowledgeHunter Prits
KnowledgeHunter Prits

Reputation: 97

Launch template is similar to launch configuration which usually Auto Scaling group uses to launch EC2 instances. However, defining a launch template instead of a launch configuration allows you to have multiple versions of a template.

AWS recommend that we should use launch templates instead of launch configurations to ensure that we can leverage the latest features of Amazon EC2, such as T2 Unlimited instances.

launch configurations are used with Auto Scaling Groups. While launch templates are used when you launch an instance using the aws EC2 console, an AWS SDK, or a command line tool.

Launch templates enable you to store the parameters (AMI, instance type, security groups, and key pairs etc.) so that you do not need to define these parameters every time you launch a new instance.

Upvotes: 5

Marcin
Marcin

Reputation: 238957

Launch templates (LTs) are newer than launch configurations (LCs) and provide more options to work with. Thus, the AWS documentation recommends use of launch templates (LTs) over launch configuration (LCs):

We recommend that you create Auto Scaling groups from launch templates to ensure that you're getting the latest features from Amazon EC2.

One of the practical key differences between LT and LC is the fact that LC is immutable. Once you define it, you can't edit it. Only a replacement is an option. However, a single LT can have multiple versions:

defining a launch template instead of a launch configuration allows you to have multiple versions of a template. With versioning, you can create a subset of the full set of parameters and then reuse it to create other templates or template versions.

Also LTs provide more EC2 options for you to configure, for example, dedicated hosting can be set only using a LT. Similarly, ability to use T2 unlimited burst credit option is only available in a LT.

Thus if you can, its better to follow AWS recommendation and use LT.

Upvotes: 104

Related Questions