EC2 Launch Configuration vs Launch Template

Both Launch Configuration and Launch Template allow you to define configuration of EC2 Instances that would be created under a given Auto Scaling Group (ASG).

 

EC2 Launch Configuration

A Launch Configuration is a configuration template that defines the specifics of EC2 instance(s) that would be created as part of an Auto Scaling Group (ASG). This is the set of information that you define when you are creating an individual EC2 Instance – information like AMI, Instance Type, Key Pair, Security Group(s), Storage (block device mapping), etc.

Key points:

  • Once defined, you can use a specific Launch Configuration with multiple Auto Scaling Groups (ASGs). However, you can only have one Launch Configuration for any specific ASG.
  • Once defined, you cannot change the Launch Configuration. You can however create a new Launch Configuration and associate it with the ASG – by doing so, you replace the older Launch Configuration by this one.
  • AWS now recommends that instead of Launch Configuration you rather use Launch Template with an ASG. Launch Template is much more flexible than Launch Configuration – see details below.

 

Snapshot of Launch Configuration creation screen:

EC2 Launch Configuration

 


Launch Template

Like Launch Configuration, a Launch Template specifies configuration for an EC2 Instance. However, Launch Template is much more flexible (see key points below), as well as it provides for more features to be used as part of ASG (such as – you can have both On-demand and Spot Instances within the same ASG, via Launch Template).

Key points:

  • You can have multiple versions of a Launch Template.
  • Versioning allows you to modularize configurations – that is – you can group logical parameters in one Template version, and then reuse that version as a subset in other Templates
  • Versioning also makes it easier to take updated configuration to an active ASG. E.g., you can specify at ASG creation to always use newest version of a Template.
  • Launch Template also allows you use Dedicated Hosts for EC2, and thus additionally allowing you to bring your (eligible) software licenses onto AWS EC2 Instances.
  • Launch Template also allows configuring a specific network type (VPC / EC2-Classic), Subnet, and Availability Zone (note: these configuration as defined in ASG takes precedence)

 

Snapshot of Launch Template creation screen:

EC2 Launch Template

 


External Resources