Configuration to create an Amazon EC2 Launch Template to be used to provision EC2 Instances. The template includes customizable settings such as configuring instance type, image id, IMDS enforcement, volume and interface settings, and more.

All settings in the launch template are optional:

  • Launch Template Name
  • Instance Image: Set the EC2 image id to be used when launching instances
  • Instance Type: Specify instance size (e.g. Memory and CPU settings) based on the instance type
  • Instance Metadata Service (IMDS): Enforce IMDSv2 or allow both IMDS v1 and v2 (CloudFormation requires the creation of a Launch Template to enable this setting)
  • SSH Key: Provide the name for a pre-existing Key Pair
  • IAM Instance Profile Arn: Specify an IAM role to be attached to the EC2 instances launched 
  • Customize EBS Volumes: By default one EBS volume is attached, but more can be added with settings that include: volume type, volume size, device name, encryption key, and more
  • Customize Network Interfaces (ENIs): By default one interface is attached, but more interfaces can be added with settings that include: subnet Id, static IP address, security group(s), description, and more
  • User Data: Provide commands (Windows or Linux) to be run at the time of instance launch
  • More settings such as disabling API termination, enabling EBS optimization, enabling detailed monitoring, and controlling the instance shutdown behaviour
Items
1
Size
0.6 KB
AWSTemplateFormatVersion: '2010-09-09'
Description: ''
Resources:
  Ec2LaunchTemplate:
    Type: 'AWS::EC2::LaunchTemplate'
    Properties:
      LaunchTemplateData:
        ImageId:
          Ref: amazon2
        DisableApiTermination: false
        InstanceInitiatedShutdownBehavior: stop
        Monitoring:
          Enabled: false
        MetadataOptions:
          HttpEndpoint: enabled
          HttpTokens: required
Parameters:
  amazon2:
    Type: 'AWS::SSM::Parameter::Value<AWS::EC2::Image::Id>'
    Default: /aws/service/ami-amazon-linux-latest/amzn2-ami-hvm-x86_64-gp2
Metadata: {}
Conditions: {}

Actions



Customize Template


* Required field