

This is the new *CloudFormation Template Reference Guide*. Please update your bookmarks and links. For help getting started with CloudFormation, see the [AWS CloudFormation User Guide](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/Welcome.html).

# AWS::AutoScaling::LaunchConfiguration
<a name="aws-resource-autoscaling-launchconfiguration"></a>

The `AWS::AutoScaling::LaunchConfiguration` resource specifies the launch configuration that can be used by an Auto Scaling group to configure Amazon EC2 instances. 

When you update the launch configuration for an Auto Scaling group, CloudFormation deletes that resource and creates a new launch configuration with the updated properties and a new name. Existing instances are not affected. To update existing instances when you update the `AWS::AutoScaling::LaunchConfiguration` resource, you can specify an [UpdatePolicy attribute](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-updatepolicy.html) for the group. You can find sample update policies for rolling updates in [Configure Amazon EC2 Auto Scaling resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/quickref-ec2-auto-scaling.html). 

**Note**  
Amazon EC2 Auto Scaling configures instances launched as part of an Auto Scaling group using either a [launch template](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-launchtemplate.html) or a launch configuration. We strongly recommend that you do not use launch configurations. For more information, see [Launch configurations](https://docs.aws.amazon.com/autoscaling/ec2/userguide/launch-configurations.html) in the *Amazon EC2 Auto Scaling User Guide*.  
For help migrating from launch configurations to launch templates, see [Migrate AWS CloudFormation stacks from launch configurations to launch templates](https://docs.aws.amazon.com/autoscaling/ec2/userguide/migrate-launch-configurations-with-cloudformation.html) in the *Amazon EC2 Auto Scaling User Guide*.

## Syntax
<a name="aws-resource-autoscaling-launchconfiguration-syntax"></a>

To declare this entity in your CloudFormation template, use the following syntax:

### JSON
<a name="aws-resource-autoscaling-launchconfiguration-syntax.json"></a>

```
{
  "Type" : "AWS::AutoScaling::LaunchConfiguration",
  "Properties" : {
      "[AssociatePublicIpAddress](#cfn-autoscaling-launchconfiguration-associatepublicipaddress)" : Boolean,
      "[BlockDeviceMappings](#cfn-autoscaling-launchconfiguration-blockdevicemappings)" : [ BlockDeviceMapping, ... ],
      "[ClassicLinkVPCId](#cfn-autoscaling-launchconfiguration-classiclinkvpcid)" : String,
      "[ClassicLinkVPCSecurityGroups](#cfn-autoscaling-launchconfiguration-classiclinkvpcsecuritygroups)" : [ String, ... ],
      "[EbsOptimized](#cfn-autoscaling-launchconfiguration-ebsoptimized)" : Boolean,
      "[IamInstanceProfile](#cfn-autoscaling-launchconfiguration-iaminstanceprofile)" : String,
      "[ImageId](#cfn-autoscaling-launchconfiguration-imageid)" : String,
      "[InstanceId](#cfn-autoscaling-launchconfiguration-instanceid)" : String,
      "[InstanceMonitoring](#cfn-autoscaling-launchconfiguration-instancemonitoring)" : Boolean,
      "[InstanceType](#cfn-autoscaling-launchconfiguration-instancetype)" : String,
      "[KernelId](#cfn-autoscaling-launchconfiguration-kernelid)" : String,
      "[KeyName](#cfn-autoscaling-launchconfiguration-keyname)" : String,
      "[LaunchConfigurationName](#cfn-autoscaling-launchconfiguration-launchconfigurationname)" : String,
      "[MetadataOptions](#cfn-autoscaling-launchconfiguration-metadataoptions)" : MetadataOptions,
      "[PlacementTenancy](#cfn-autoscaling-launchconfiguration-placementtenancy)" : String,
      "[RamDiskId](#cfn-autoscaling-launchconfiguration-ramdiskid)" : String,
      "[SecurityGroups](#cfn-autoscaling-launchconfiguration-securitygroups)" : [ String, ... ],
      "[SpotPrice](#cfn-autoscaling-launchconfiguration-spotprice)" : String,
      "[UserData](#cfn-autoscaling-launchconfiguration-userdata)" : String
    }
}
```

### YAML
<a name="aws-resource-autoscaling-launchconfiguration-syntax.yaml"></a>

```
Type: AWS::AutoScaling::LaunchConfiguration
Properties:
  [AssociatePublicIpAddress](#cfn-autoscaling-launchconfiguration-associatepublicipaddress): Boolean
  [BlockDeviceMappings](#cfn-autoscaling-launchconfiguration-blockdevicemappings): 
    - BlockDeviceMapping
  [ClassicLinkVPCId](#cfn-autoscaling-launchconfiguration-classiclinkvpcid): String
  [ClassicLinkVPCSecurityGroups](#cfn-autoscaling-launchconfiguration-classiclinkvpcsecuritygroups): 
    - String
  [EbsOptimized](#cfn-autoscaling-launchconfiguration-ebsoptimized): Boolean
  [IamInstanceProfile](#cfn-autoscaling-launchconfiguration-iaminstanceprofile): String
  [ImageId](#cfn-autoscaling-launchconfiguration-imageid): String
  [InstanceId](#cfn-autoscaling-launchconfiguration-instanceid): String
  [InstanceMonitoring](#cfn-autoscaling-launchconfiguration-instancemonitoring): Boolean
  [InstanceType](#cfn-autoscaling-launchconfiguration-instancetype): String
  [KernelId](#cfn-autoscaling-launchconfiguration-kernelid): String
  [KeyName](#cfn-autoscaling-launchconfiguration-keyname): String
  [LaunchConfigurationName](#cfn-autoscaling-launchconfiguration-launchconfigurationname): String
  [MetadataOptions](#cfn-autoscaling-launchconfiguration-metadataoptions): 
    MetadataOptions
  [PlacementTenancy](#cfn-autoscaling-launchconfiguration-placementtenancy): String
  [RamDiskId](#cfn-autoscaling-launchconfiguration-ramdiskid): String
  [SecurityGroups](#cfn-autoscaling-launchconfiguration-securitygroups): 
    - String
  [SpotPrice](#cfn-autoscaling-launchconfiguration-spotprice): String
  [UserData](#cfn-autoscaling-launchconfiguration-userdata): String
```

## Properties
<a name="aws-resource-autoscaling-launchconfiguration-properties"></a>

`AssociatePublicIpAddress`  <a name="cfn-autoscaling-launchconfiguration-associatepublicipaddress"></a>
Specifies whether to assign a public IPv4 address to the group's instances. If the instance is launched into a default subnet, the default is to assign a public IPv4 address, unless you disabled the option to assign a public IPv4 address on the subnet. If the instance is launched into a nondefault subnet, the default is not to assign a public IPv4 address, unless you enabled the option to assign a public IPv4 address on the subnet.  
If you specify `true`, each instance in the Auto Scaling group receives a unique public IPv4 address. For more information, see [Provide network connectivity for your Auto Scaling instances using Amazon VPC](https://docs.aws.amazon.com/autoscaling/ec2/userguide/asg-in-vpc.html) in the *Amazon EC2 Auto Scaling User Guide*.  
If you specify this property, you must specify at least one subnet for `VPCZoneIdentifier` when you create your group.  
*Required*: No  
*Type*: Boolean  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`BlockDeviceMappings`  <a name="cfn-autoscaling-launchconfiguration-blockdevicemappings"></a>
The block device mapping entries that define the block devices to attach to the instances at launch. By default, the block devices specified in the block device mapping for the AMI are used. For more information, see [Block device mappings](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/block-device-mapping-concepts.html) in the *Amazon EC2 User Guide*.  
*Required*: No  
*Type*: Array of [BlockDeviceMapping](aws-properties-autoscaling-launchconfiguration-blockdevicemapping.md)  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`ClassicLinkVPCId`  <a name="cfn-autoscaling-launchconfiguration-classiclinkvpcid"></a>
Available for backward compatibility.  
*Required*: No  
*Type*: String  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`ClassicLinkVPCSecurityGroups`  <a name="cfn-autoscaling-launchconfiguration-classiclinkvpcsecuritygroups"></a>
Available for backward compatibility.  
*Required*: Conditional  
*Type*: Array of String  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`EbsOptimized`  <a name="cfn-autoscaling-launchconfiguration-ebsoptimized"></a>
Specifies whether the launch configuration is optimized for EBS I/O (`true`) or not (`false`). The optimization provides dedicated throughput to Amazon EBS and an optimized configuration stack to provide optimal I/O performance. This optimization is not available with all instance types. Additional fees are incurred when you enable EBS optimization for an instance type that is not EBS-optimized by default. For more information, see [Amazon EBS-optimized instances](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-optimized.html) in the *Amazon EC2 User Guide*.  
The default value is `false`.  
*Required*: No  
*Type*: Boolean  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`IamInstanceProfile`  <a name="cfn-autoscaling-launchconfiguration-iaminstanceprofile"></a>
The name or the Amazon Resource Name (ARN) of the instance profile associated with the IAM role for the instance. The instance profile contains the IAM role. For more information, see [IAM role for applications that run on Amazon EC2 instances](https://docs.aws.amazon.com/autoscaling/ec2/userguide/us-iam-role.html) in the *Amazon EC2 Auto Scaling User Guide*.  
*Required*: No  
*Type*: String  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`ImageId`  <a name="cfn-autoscaling-launchconfiguration-imageid"></a>
The ID of the Amazon Machine Image (AMI) that was assigned during registration. For more information, see [Find a Linux AMI](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/finding-an-ami.html) in the *Amazon EC2 User Guide*.  
If you specify `InstanceId`, an `ImageId` is not required.  
*Required*: Conditional  
*Type*: String  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`InstanceId`  <a name="cfn-autoscaling-launchconfiguration-instanceid"></a>
The ID of the Amazon EC2 instance to use to create the launch configuration. When you use an instance to create a launch configuration, all properties are derived from the instance with the exception of `BlockDeviceMapping` and `AssociatePublicIpAddress`. You can override any properties from the instance by specifying them in the launch configuration.   
*Required*: No  
*Type*: String  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`InstanceMonitoring`  <a name="cfn-autoscaling-launchconfiguration-instancemonitoring"></a>
Controls whether instances in this group are launched with detailed (`true`) or basic (`false`) monitoring.  
The default value is `true` (enabled).  
When detailed monitoring is enabled, Amazon CloudWatch generates metrics every minute and your account is charged a fee. When you disable detailed monitoring, CloudWatch generates metrics every 5 minutes. For more information, see [Configure monitoring for Auto Scaling instances](https://docs.aws.amazon.com/autoscaling/latest/userguide/enable-as-instance-metrics.html) in the *Amazon EC2 Auto Scaling User Guide*.
*Required*: No  
*Type*: Boolean  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`InstanceType`  <a name="cfn-autoscaling-launchconfiguration-instancetype"></a>
Specifies the instance type of the EC2 instance. For information about available instance types, see [Available instance types](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html#AvailableInstanceTypes) in the *Amazon EC2 User Guide*.  
If you specify `InstanceId`, an `InstanceType` is not required.  
*Required*: Conditional  
*Type*: String  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`KernelId`  <a name="cfn-autoscaling-launchconfiguration-kernelid"></a>
The ID of the kernel associated with the AMI.  
We recommend that you use PV-GRUB instead of kernels and RAM disks. For more information, see [User provided kernels](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UserProvidedKernels.html) in the *Amazon EC2 User Guide*.
*Required*: No  
*Type*: String  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`KeyName`  <a name="cfn-autoscaling-launchconfiguration-keyname"></a>
The name of the key pair. For more information, see [Amazon EC2 key pairs and Amazon EC2 instances](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html) in the *Amazon EC2 User Guide*.  
*Required*: No  
*Type*: String  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`LaunchConfigurationName`  <a name="cfn-autoscaling-launchconfiguration-launchconfigurationname"></a>
The name of the launch configuration. This name must be unique per Region per account.  
*Required*: No  
*Type*: String  
*Minimum*: `1`  
*Maximum*: `255`  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`MetadataOptions`  <a name="cfn-autoscaling-launchconfiguration-metadataoptions"></a>
The metadata options for the instances. For more information, see [Configure the instance metadata options](https://docs.aws.amazon.com/autoscaling/ec2/userguide/create-launch-config.html#launch-configurations-imds) in the *Amazon EC2 Auto Scaling User Guide*.  
*Required*: No  
*Type*: [MetadataOptions](aws-properties-autoscaling-launchconfiguration-metadataoptions.md)  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`PlacementTenancy`  <a name="cfn-autoscaling-launchconfiguration-placementtenancy"></a>
The tenancy of the instance, either `default` or `dedicated`. An instance with `dedicated` tenancy runs on isolated, single-tenant hardware and can only be launched into a VPC. To launch dedicated instances into a shared tenancy VPC (a VPC with the instance placement tenancy attribute set to `default`), you must set the value of this property to `dedicated`.  
If you specify `PlacementTenancy`, you must specify at least one subnet for `VPCZoneIdentifier` when you create your group.  
Valid values: `default` \$1 `dedicated`  
*Required*: No  
*Type*: String  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`RamDiskId`  <a name="cfn-autoscaling-launchconfiguration-ramdiskid"></a>
The ID of the RAM disk to select.  
We recommend that you use PV-GRUB instead of kernels and RAM disks. For more information, see [User provided kernels](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UserProvidedKernels.html) in the *Amazon EC2 User Guide*.
*Required*: No  
*Type*: String  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`SecurityGroups`  <a name="cfn-autoscaling-launchconfiguration-securitygroups"></a>
A list that contains the security groups to assign to the instances in the Auto Scaling group. The list can contain both the IDs of existing security groups and references to [SecurityGroup](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group.html) resources created in the template.  
For more information, see [Control traffic to resources using security groups](https://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_SecurityGroups.html) in the *Amazon Virtual Private Cloud User Guide*.   
*Required*: No  
*Type*: Array of String  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`SpotPrice`  <a name="cfn-autoscaling-launchconfiguration-spotprice"></a>
The maximum hourly price to be paid for any Spot Instance launched to fulfill the request. Spot Instances are launched when the price you specify exceeds the current Spot price. For more information, see [Request Spot Instances for fault-tolerant and flexible applications](https://docs.aws.amazon.com/autoscaling/ec2/userguide/launch-template-spot-instances.html) in the *Amazon EC2 Auto Scaling User Guide*.  
Valid Range: Minimum value of 0.001  
When you change your maximum price by creating a new launch configuration, running instances will continue to run as long as the maximum price for those running instances is higher than the current Spot price.
*Required*: No  
*Type*: String  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`UserData`  <a name="cfn-autoscaling-launchconfiguration-userdata"></a>
The Base64-encoded user data to make available to the launched EC2 instances. For more information, see [Instance metadata and user data](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html) in the *Amazon EC2 User Guide for Linux Instances*.  
*Required*: No  
*Type*: String  
*Maximum*: `21847`  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

## Return values
<a name="aws-resource-autoscaling-launchconfiguration-return-values"></a>

### Ref
<a name="aws-resource-autoscaling-launchconfiguration-return-values-ref"></a>

When you pass the logical ID of this resource to the intrinsic `Ref` function, `Ref` returns the resource name. For example: `mystack-mylaunchconfig-1DDYF1E3B3I`.

For more information about using the `Ref` function, see [https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/intrinsic-function-reference-ref.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/intrinsic-function-reference-ref.html).

## Remarks
<a name="aws-resource-autoscaling-launchconfiguration--remarks"></a>

CloudFormation marks the Auto Scaling group as successful (by setting its status to CREATE\$1COMPLETE) when its desired capacity is reached. However, if `SpotPrice` is set in the launch configuration, then desired capacity is not used as a criteria for success. Whether your request is fulfilled depends on Spot Instance capacity and your maximum price. If the current Spot price is less than your specified maximum price, Amazon EC2 Auto Scaling uses the desired capacity as the target capacity for the group. If the request for Spot Instances is unsuccessful, it keeps trying. 

If your Auto Scaling instances receive a public IPv4 address and are launched in a VPC that is defined in the same stack template, you must use the [DependsOn attribute](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-dependson.html) to declare a dependency on the [VPC-gateway attachment](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpc-gateway-attachment.html). 

## Examples
<a name="aws-resource-autoscaling-launchconfiguration--examples"></a>

The following examples create launch configurations that can be used by an Auto Scaling group to configure Amazon EC2 instances. 

**Topics**
+ [Amazon EBS-backed AMI and defined block device mappings](#aws-resource-autoscaling-launchconfiguration--examples--Amazon_EBS-backed_AMI_and_defined_block_device_mappings)
+ [Instance store-backed AMI with Spot price and IAM role](#aws-resource-autoscaling-launchconfiguration--examples--Instance_store-backed_AMI_with_Spot_price_and_IAM_role)
+ [Provisioned IOPS EBS-optimized volume with key-pair name and user data](#aws-resource-autoscaling-launchconfiguration--examples--Provisioned_IOPS_EBS-optimized_volume_with_key-pair_name_and_user_data)

### Amazon EBS-backed AMI and defined block device mappings
<a name="aws-resource-autoscaling-launchconfiguration--examples--Amazon_EBS-backed_AMI_and_defined_block_device_mappings"></a>

This example shows a launch configuration with a `BlockDeviceMappings` property that lists two devices: a 30 gigabyte EBS root volume mapped to /dev/sda1 and a 100 gigabyte EBS volume mapped to /dev/sdm. The /dev/sdm volume uses the default EBS volume type based on the region and is not deleted when terminating the instance it is attached to. 

CloudFormation supports parameters from the AWS Systems Manager Parameter Store. In this example, the `ImageId` property references the latest Amazon Linux 2 AMI (EBS-backed image) from the Parameter Store. For more information, see [AWS Systems Manager Parameter Store](https://docs.aws.amazon.com/systems-manager/latest/userguide/systems-manager-parameter-store.html) in the *AWS Systems Manager User Guide* and the blog post [Query for the latest Amazon Linux AMI IDs using AWS Systems Manager Parameter Store](https://aws.amazon.com/blogs/compute/query-for-the-latest-amazon-linux-ami-ids-using-aws-systems-manager-parameter-store/) on the AWS Compute Blog.

#### JSON
<a name="aws-resource-autoscaling-launchconfiguration--examples--Amazon_EBS-backed_AMI_and_defined_block_device_mappings--json"></a>

```
{
  "AWSTemplateFormatVersion": "2010-09-09",
  "Parameters": {
    "LatestAmiId": {
      "Description": "Region specific image from the Parameter Store",
      "Type": "AWS::SSM::Parameter::Value<AWS::EC2::Image::Id>",
      "Default": "/aws/service/ami-amazon-linux-latest/amzn2-ami-hvm-x86_64-gp2"
    },
    "InstanceType": {
      "Description": "Amazon EC2 instance type for the instances",
      "Type": "String",
      "AllowedValues": [
        "t3.micro",
        "t3.small",
        "t3.medium"
      ],
      "Default": "t3.micro"
    }
  },  
  "Resources":{
    "myLaunchConfig":{
      "Type":"AWS::AutoScaling::LaunchConfiguration",
      "Properties":{
        "ImageId":{ "Ref":"LatestAmiId" },
        "SecurityGroups":[ { "Ref":"myEC2SecurityGroup" } ],
        "InstanceType":{ "Ref":"InstanceType" },
        "BlockDeviceMappings":[
          {
            "DeviceName":"/dev/sda1",
            "Ebs":{
              "VolumeSize":"30",
              "VolumeType":"gp3"
            }
          },
          {
            "DeviceName":"/dev/sdm",
            "Ebs":{
              "VolumeSize":"100",
              "DeleteOnTermination":"false"
            }
          }
        ]
      }
    }
  }
}
```

#### YAML
<a name="aws-resource-autoscaling-launchconfiguration--examples--Amazon_EBS-backed_AMI_and_defined_block_device_mappings--yaml"></a>

```
---
AWSTemplateFormatVersion: 2010-09-09
Parameters:
  LatestAmiId:
    Description: Region specific image from the Parameter Store
    Type: 'AWS::SSM::Parameter::Value<AWS::EC2::Image::Id>'
    Default: '/aws/service/ami-amazon-linux-latest/amzn2-ami-hvm-x86_64-gp2'
  InstanceType:
    Description: Amazon EC2 instance type for the instances
    Type: String
    AllowedValues:
      - t3.micro
      - t3.small
      - t3.medium
    Default: t3.micro
Resources:
  myLaunchConfig: 
    Type: AWS::AutoScaling::LaunchConfiguration
    Properties:
      ImageId: !Ref LatestAmiId
      SecurityGroups: 
        - !Ref myEC2SecurityGroup
      InstanceType: 
        !Ref InstanceType
      BlockDeviceMappings: 
        - DeviceName: /dev/sda1
          Ebs: 
            VolumeSize: '30'
            VolumeType: gp3
        - DeviceName: /dev/sdm
          Ebs: 
            VolumeSize: '100'
            DeleteOnTermination: false
```

### Instance store-backed AMI with Spot price and IAM role
<a name="aws-resource-autoscaling-launchconfiguration--examples--Instance_store-backed_AMI_with_Spot_price_and_IAM_role"></a>

This example shows a launch configuration that launches Spot Instances in the Auto Scaling group. This launch configuration will only be active if the current Spot price is less than the price in the template specification (0.045). It also demonstrates a launch configuration that uses the `IamInstanceProfile` property. For an example of a full template, including the definition of, and further references from the [InstanceProfile](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-instanceprofile.html) object referenced here as `RootInstanceProfile`, see [auto\$1scaling\$1with\$1instance\$1profile.template](https://s3.amazonaws.com/cloudformation-templates-us-east-1/auto_scaling_with_instance_profile.template).

In this example, the `ImageId` property references the latest Amazon Linux AMI (instance store/S3-backed image) from the Parameter Store. The BlockDeviceMappings property lists a virtual device `ephemeral0` mapped to /dev/sdc.

#### JSON
<a name="aws-resource-autoscaling-launchconfiguration--examples--Instance_store-backed_AMI_with_Spot_price_and_IAM_role--json"></a>

```
{
  "AWSTemplateFormatVersion": "2010-09-09",
  "Parameters": {
    "LatestAmiId": {
      "Description": "Region specific image from the Parameter Store",
      "Type": "AWS::SSM::Parameter::Value<AWS::EC2::Image::Id>",
      "Default": "/aws/service/ami-amazon-linux-latest/amzn-ami-hvm-x86_64-s3"
    }
  },
  "Resources":{
    "myLaunchConfig":{
      "Type":"AWS::AutoScaling::LaunchConfiguration",
      "Properties":{
        "ImageId":{ "Ref":"LatestAmiId" },
        "SecurityGroups":[ { "Ref":"myEC2SecurityGroup" } ],
        "InstanceType":"m3.medium",
        "SpotPrice":"0.045",
        "IamInstanceProfile":{ "Ref":"RootInstanceProfile" },
        "BlockDeviceMappings": [
          {
            "DeviceName": "/dev/sdc",
            "VirtualName": "ephemeral0"
          }
        ]
      }
    }
  }
}
```

#### YAML
<a name="aws-resource-autoscaling-launchconfiguration--examples--Instance_store-backed_AMI_with_Spot_price_and_IAM_role--yaml"></a>

```
---
AWSTemplateFormatVersion: 2010-09-09
Parameters:
  LatestAmiId:
    Description: Region specific image from the Parameter Store
    Type: 'AWS::SSM::Parameter::Value<AWS::EC2::Image::Id>'
    Default: '/aws/service/ami-amazon-linux-latest/amzn-ami-hvm-x86_64-s3'
Resources:
  myLaunchConfig: 
    Type: AWS::AutoScaling::LaunchConfiguration
    Properties: 
      ImageId: !Ref LatestAmiId
      SecurityGroups: 
        - !Ref myEC2SecurityGroup
      InstanceType: m3.medium
      SpotPrice: '0.045'
      IamInstanceProfile: !Ref RootInstanceProfile
      BlockDeviceMappings:
      - DeviceName: /dev/sdc
        VirtualName: ephemeral0
```

### Provisioned IOPS EBS-optimized volume with key-pair name and user data
<a name="aws-resource-autoscaling-launchconfiguration--examples--Provisioned_IOPS_EBS-optimized_volume_with_key-pair_name_and_user_data"></a>

This example demonstrates a launch configuration that configures the `EbsOptmized` property to launch instances with a provisioned IOPS EBS-optimized volume. This can increase the performance of your EBS-backed instances.

**Note**  
For instances that are not EBS–optimized by default, you must enable EBS optimization to achieve the level of performance described in the [Amazon EBS-optimized instances](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSOptimized.html) documentation in the *Amazon Elastic Compute Cloud User Guide*. For current generation instance types, EBS-optimization is enabled by default at no additional cost. Enabling EBS optimization for a previous generation instance type that is not EBS-optimized by default incurs additional fees.

When you use a launch configuration such as this one, your `m1.large` instances will contain optimized EBS root volumes with the provisioned IOPS settings that you specified in the AMI. Because you cannot specify the IOPS settings in a launch configuration, the AMI must be configured with a block device mapping that specifies the desired number of IOPS. The following are key attributes of this EBS-optimized instance configuration:
+ An instance type of `m1.large` or greater. This is required for EBS optimization. This optimization is only available for certain instance types and sizes.
+ An EBS-backed AMI with a volume type of `io1` and the number of IOPS you want to provision for the volume. 
+ The size of the EBS volume must accommodate the IOPS you need. There is a 50:1 ratio between IOPS and Gibibytes (GiB) of storage.

For more information about IOPS performance with provisioned IOPS volumes, see [Provisioned IOPS SSD (`io1` and `io2`) volumes](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html#EBSVolumeTypes_piops) in the *Amazon Elastic Compute Cloud User Guide*.

For more performance tips, see [Amazon EBS volume performance on Linux instances](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSPerformance.html) in the *Amazon Elastic Compute Cloud User Guide*. 

 

#### JSON
<a name="aws-resource-autoscaling-launchconfiguration--examples--Provisioned_IOPS_EBS-optimized_volume_with_key-pair_name_and_user_data--json"></a>

```
{
  "Resources":{
    "myLaunchConfig":{
      "Type":"AWS::AutoScaling::LaunchConfiguration",
      "Properties":{
        "ImageId":"ami-02354e95b3example",
        "SecurityGroups":[ { "Ref":"myEC2SecurityGroup" }, "myExistingEC2SecurityGroup" ],
        "InstanceType":"m1.large",
        "UserData": {"Fn::Base64": {"Fn::Join": ["", [
          "#!/bin/bash -x\n",
          "/opt/aws/bin/cfn-signal -e $? --stack ", {"Ref": "AWS::StackName"}, " --resource myASG ", " --region ", {"Ref": "AWS::Region"}, "\n"
        ]]}},
        "EbsOptimized":"true"
      }
    }
  }
}
```

#### YAML
<a name="aws-resource-autoscaling-launchconfiguration--examples--Provisioned_IOPS_EBS-optimized_volume_with_key-pair_name_and_user_data--yaml"></a>

```
---
Resources:
  myLaunchConfig: 
    Type: AWS::AutoScaling::LaunchConfiguration
    Properties: 
      ImageId: ami-02354e95b3example
      SecurityGroups: 
        - !Ref myEC2SecurityGroup
        - myExistingEC2SecurityGroup
      InstanceType: m1.large
      UserData: !Base64 |
        #!/bin/bash -x
        yum install -y aws-cfn-bootstrap
        /opt/aws/bin/cfn-signal -e $? --stack !Ref 'AWS::StackName' --resource myASG --region !Ref 'AWS::Region'
      EbsOptimized: true
```

## See also
<a name="aws-resource-autoscaling-launchconfiguration--seealso"></a>
+ You can find additional useful snippets in the following sections of the *AWS CloudFormation User Guide*:
  + For examples of Auto Scaling groups, see [Configure Amazon EC2 Auto Scaling resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/quickref-ec2-auto-scaling.html).
  + For examples of launch templates, see [Create launch templates](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/quickref-ec2-launch-templates.html).
+ [Migrate AWS CloudFormation stacks from launch configurations to launch templates](https://docs.aws.amazon.com/autoscaling/ec2/userguide/migrate-launch-configurations-with-cloudformation.html) in the *Amazon EC2 Auto Scaling User Guide*
+ [CreateLaunchConfiguration](https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_CreateLaunchConfiguration.html) in the *Amazon EC2 Auto Scaling API Reference*



# AWS::AutoScaling::LaunchConfiguration BlockDevice
<a name="aws-properties-autoscaling-launchconfiguration-blockdevice"></a>

`BlockDevice` is a property of the `EBS` property of the [AWS::AutoScaling::LaunchConfiguration BlockDeviceMapping](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-launchconfiguration-blockdevicemapping.html) property type that describes an Amazon EBS volume.

## Syntax
<a name="aws-properties-autoscaling-launchconfiguration-blockdevice-syntax"></a>

To declare this entity in your CloudFormation template, use the following syntax:

### JSON
<a name="aws-properties-autoscaling-launchconfiguration-blockdevice-syntax.json"></a>

```
{
  "[DeleteOnTermination](#cfn-autoscaling-launchconfiguration-blockdevice-deleteontermination)" : Boolean,
  "[Encrypted](#cfn-autoscaling-launchconfiguration-blockdevice-encrypted)" : Boolean,
  "[Iops](#cfn-autoscaling-launchconfiguration-blockdevice-iops)" : Integer,
  "[SnapshotId](#cfn-autoscaling-launchconfiguration-blockdevice-snapshotid)" : String,
  "[Throughput](#cfn-autoscaling-launchconfiguration-blockdevice-throughput)" : Integer,
  "[VolumeSize](#cfn-autoscaling-launchconfiguration-blockdevice-volumesize)" : Integer,
  "[VolumeType](#cfn-autoscaling-launchconfiguration-blockdevice-volumetype)" : String
}
```

### YAML
<a name="aws-properties-autoscaling-launchconfiguration-blockdevice-syntax.yaml"></a>

```
  [DeleteOnTermination](#cfn-autoscaling-launchconfiguration-blockdevice-deleteontermination): Boolean
  [Encrypted](#cfn-autoscaling-launchconfiguration-blockdevice-encrypted): Boolean
  [Iops](#cfn-autoscaling-launchconfiguration-blockdevice-iops): Integer
  [SnapshotId](#cfn-autoscaling-launchconfiguration-blockdevice-snapshotid): String
  [Throughput](#cfn-autoscaling-launchconfiguration-blockdevice-throughput): Integer
  [VolumeSize](#cfn-autoscaling-launchconfiguration-blockdevice-volumesize): Integer
  [VolumeType](#cfn-autoscaling-launchconfiguration-blockdevice-volumetype): String
```

## Properties
<a name="aws-properties-autoscaling-launchconfiguration-blockdevice-properties"></a>

`DeleteOnTermination`  <a name="cfn-autoscaling-launchconfiguration-blockdevice-deleteontermination"></a>
Indicates whether the volume is deleted on instance termination. For Amazon EC2 Auto Scaling, the default value is `true`.  
*Required*: No  
*Type*: Boolean  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`Encrypted`  <a name="cfn-autoscaling-launchconfiguration-blockdevice-encrypted"></a>
Specifies whether the volume should be encrypted. Encrypted EBS volumes can only be attached to instances that support Amazon EBS encryption. For more information, see [Requirements for Amazon EBS encryption](https://docs.aws.amazon.com/ebs/latest/userguide/ebs-encryption-requirements.html) in the *Amazon EBS User Guide*. If your AMI uses encrypted volumes, you can also only launch it on supported instance types.  
If you are creating a volume from a snapshot, you cannot create an unencrypted volume from an encrypted snapshot. Also, you cannot specify a KMS key ID when using a launch configuration.  
If you enable encryption by default, the EBS volumes that you create are always encrypted, either using the AWS managed KMS key or a customer-managed KMS key, regardless of whether the snapshot was encrypted.   
For more information, see [Use AWS KMS keys to encrypt Amazon EBS volumes](https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-data-protection.html#encryption) in the *Amazon EC2 Auto Scaling User Guide*.
*Required*: No  
*Type*: Boolean  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`Iops`  <a name="cfn-autoscaling-launchconfiguration-blockdevice-iops"></a>
The number of input/output (I/O) operations per second (IOPS) to provision for the volume. For `gp3` and `io1` volumes, this represents the number of IOPS that are provisioned for the volume. For `gp2` volumes, this represents the baseline performance of the volume and the rate at which the volume accumulates I/O credits for bursting.   
The following are the supported values for each volume type:   
+ `gp3`: 3,000-16,000 IOPS
+ `io1`: 100-64,000 IOPS
For `io1` volumes, we guarantee 64,000 IOPS only for [Instances built on the Nitro System](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html#ec2-nitro-instances). Other instance families guarantee performance up to 32,000 IOPS.   
`Iops` is supported when the volume type is `gp3` or `io1` and required only when the volume type is `io1`. (Not used with `standard`, `gp2`, `st1`, or `sc1` volumes.)   
*Required*: Conditional  
*Type*: Integer  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`SnapshotId`  <a name="cfn-autoscaling-launchconfiguration-blockdevice-snapshotid"></a>
The snapshot ID of the volume to use.  
You must specify either a `VolumeSize` or a `SnapshotId`.  
*Required*: Conditional  
*Type*: String  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`Throughput`  <a name="cfn-autoscaling-launchconfiguration-blockdevice-throughput"></a>
The throughput (MiBps) to provision for a `gp3` volume.  
*Required*: No  
*Type*: Integer  
*Minimum*: `125`  
*Maximum*: `1000`  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`VolumeSize`  <a name="cfn-autoscaling-launchconfiguration-blockdevice-volumesize"></a>
The volume size, in GiBs. The following are the supported volumes sizes for each volume type:   
+ `gp2` and `gp3`: 1-16,384
+ `io1`: 4-16,384
+ `st1` and `sc1`: 125-16,384
+ `standard`: 1-1,024
You must specify either a `SnapshotId` or a `VolumeSize`. If you specify both `SnapshotId` and `VolumeSize`, the volume size must be equal or greater than the size of the snapshot.  
*Required*: Conditional  
*Type*: Integer  
*Minimum*: `1`  
*Maximum*: `16384`  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`VolumeType`  <a name="cfn-autoscaling-launchconfiguration-blockdevice-volumetype"></a>
The volume type. For more information, see [Amazon EBS volume types](https://docs.aws.amazon.com/ebs/latest/userguide/ebs-volume-types.html) in the *Amazon EBS User Guide*.  
Valid values: `standard` \$1 `io1` \$1 `gp2` \$1 `st1` \$1 `sc1` \$1 `gp3`  
*Required*: No  
*Type*: String  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

## See also
<a name="aws-properties-autoscaling-launchconfiguration-blockdevice--seealso"></a>
+ [Required KMS key policy for use with encrypted volumes](https://docs.aws.amazon.com/autoscaling/ec2/userguide/key-policy-requirements-EBS-encryption.html) in the *Amazon EC2 Auto Scaling User Guide*
+ [Use encryption with EBS-backed AMIs](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AMIEncryption.html) in the *Amazon EC2 User Guide for Linux Instances*



# AWS::AutoScaling::LaunchConfiguration BlockDeviceMapping
<a name="aws-properties-autoscaling-launchconfiguration-blockdevicemapping"></a>

`BlockDeviceMapping` specifies a block device mapping for the `BlockDeviceMappings` property of the [AWS::AutoScaling::LaunchConfiguration](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-autoscaling-launchconfiguration.html) resource.

Each instance that is launched has an associated root device volume, either an Amazon EBS volume or an instance store volume. You can use block device mappings to specify additional EBS volumes or instance store volumes to attach to an instance when it is launched. 

For more information, see [Example block device mapping](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/block-device-mapping-concepts.html#block-device-mapping-ex) in the *Amazon EC2 User Guide for Linux Instances*.

## Syntax
<a name="aws-properties-autoscaling-launchconfiguration-blockdevicemapping-syntax"></a>

To declare this entity in your CloudFormation template, use the following syntax:

### JSON
<a name="aws-properties-autoscaling-launchconfiguration-blockdevicemapping-syntax.json"></a>

```
{
  "[DeviceName](#cfn-autoscaling-launchconfiguration-blockdevicemapping-devicename)" : String,
  "[Ebs](#cfn-autoscaling-launchconfiguration-blockdevicemapping-ebs)" : BlockDevice,
  "[NoDevice](#cfn-autoscaling-launchconfiguration-blockdevicemapping-nodevice)" : Boolean,
  "[VirtualName](#cfn-autoscaling-launchconfiguration-blockdevicemapping-virtualname)" : String
}
```

### YAML
<a name="aws-properties-autoscaling-launchconfiguration-blockdevicemapping-syntax.yaml"></a>

```
  [DeviceName](#cfn-autoscaling-launchconfiguration-blockdevicemapping-devicename): String
  [Ebs](#cfn-autoscaling-launchconfiguration-blockdevicemapping-ebs): 
    BlockDevice
  [NoDevice](#cfn-autoscaling-launchconfiguration-blockdevicemapping-nodevice): Boolean
  [VirtualName](#cfn-autoscaling-launchconfiguration-blockdevicemapping-virtualname): String
```

## Properties
<a name="aws-properties-autoscaling-launchconfiguration-blockdevicemapping-properties"></a>

`DeviceName`  <a name="cfn-autoscaling-launchconfiguration-blockdevicemapping-devicename"></a>
The device name assigned to the volume (for example, `/dev/sdh` or `xvdh`). For more information, see [Device naming on Linux instances](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/device_naming.html) in the *Amazon EC2 User Guide*.  
To define a block device mapping, set the device name and exactly one of the following properties: `Ebs`, `NoDevice`, or `VirtualName`.
*Required*: Yes  
*Type*: String  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`Ebs`  <a name="cfn-autoscaling-launchconfiguration-blockdevicemapping-ebs"></a>
Information to attach an EBS volume to an instance at launch.  
*Required*: No  
*Type*: [BlockDevice](aws-properties-autoscaling-launchconfiguration-blockdevice.md)  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`NoDevice`  <a name="cfn-autoscaling-launchconfiguration-blockdevicemapping-nodevice"></a>
Setting this value to `true` prevents a volume that is included in the block device mapping of the AMI from being mapped to the specified device name at launch.  
If `NoDevice` is `true` for the root device, instances might fail the EC2 health check. In that case, Amazon EC2 Auto Scaling launches replacement instances.  
*Required*: No  
*Type*: Boolean  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`VirtualName`  <a name="cfn-autoscaling-launchconfiguration-blockdevicemapping-virtualname"></a>
The name of the instance store volume (virtual device) to attach to an instance at launch. The name must be in the form ephemeral*X* where *X* is a number starting from zero (0), for example, `ephemeral0`.  
*Required*: No  
*Type*: String  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

## See also
<a name="aws-properties-autoscaling-launchconfiguration-blockdevicemapping--seealso"></a>
+ [Amazon EC2 instance store](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/InstanceStorage.html) in the *Amazon EC2 User Guide for Linux Instances*
+ [Amazon Elastic Block Store (Amazon EBS)](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AmazonEBS.html) in the *Amazon EC2 User Guide for Linux Instances*



# AWS::AutoScaling::LaunchConfiguration MetadataOptions
<a name="aws-properties-autoscaling-launchconfiguration-metadataoptions"></a>

`MetadataOptions` is a property of [AWS::AutoScaling::LaunchConfiguration](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-autoscaling-launchconfiguration.html) that describes metadata options for the instances.

For more information, see [Configure the instance metadata options](https://docs.aws.amazon.com/autoscaling/ec2/userguide/create-launch-config.html#launch-configurations-imds) in the *Amazon EC2 Auto Scaling User Guide*.

## Syntax
<a name="aws-properties-autoscaling-launchconfiguration-metadataoptions-syntax"></a>

To declare this entity in your CloudFormation template, use the following syntax:

### JSON
<a name="aws-properties-autoscaling-launchconfiguration-metadataoptions-syntax.json"></a>

```
{
  "[HttpEndpoint](#cfn-autoscaling-launchconfiguration-metadataoptions-httpendpoint)" : String,
  "[HttpPutResponseHopLimit](#cfn-autoscaling-launchconfiguration-metadataoptions-httpputresponsehoplimit)" : Integer,
  "[HttpTokens](#cfn-autoscaling-launchconfiguration-metadataoptions-httptokens)" : String
}
```

### YAML
<a name="aws-properties-autoscaling-launchconfiguration-metadataoptions-syntax.yaml"></a>

```
  [HttpEndpoint](#cfn-autoscaling-launchconfiguration-metadataoptions-httpendpoint): String
  [HttpPutResponseHopLimit](#cfn-autoscaling-launchconfiguration-metadataoptions-httpputresponsehoplimit): Integer
  [HttpTokens](#cfn-autoscaling-launchconfiguration-metadataoptions-httptokens): String
```

## Properties
<a name="aws-properties-autoscaling-launchconfiguration-metadataoptions-properties"></a>

`HttpEndpoint`  <a name="cfn-autoscaling-launchconfiguration-metadataoptions-httpendpoint"></a>
This parameter enables or disables the HTTP metadata endpoint on your instances. If the parameter is not specified, the default state is `enabled`.  
If you specify a value of `disabled`, you will not be able to access your instance metadata. 
*Required*: No  
*Type*: String  
*Allowed values*: `disabled | enabled`  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`HttpPutResponseHopLimit`  <a name="cfn-autoscaling-launchconfiguration-metadataoptions-httpputresponsehoplimit"></a>
The desired HTTP PUT response hop limit for instance metadata requests. The larger the number, the further instance metadata requests can travel.  
Default: 1  
*Required*: No  
*Type*: Integer  
*Minimum*: `1`  
*Maximum*: `64`  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`HttpTokens`  <a name="cfn-autoscaling-launchconfiguration-metadataoptions-httptokens"></a>
The state of token usage for your instance metadata requests. If the parameter is not specified in the request, the default state is `optional`.  
If the state is `optional`, you can choose to retrieve instance metadata with or without a signed token header on your request. If you retrieve the IAM role credentials without a token, the version 1.0 role credentials are returned. If you retrieve the IAM role credentials using a valid signed token, the version 2.0 role credentials are returned.  
If the state is `required`, you must send a signed token header with any instance metadata retrieval requests. In this state, retrieving the IAM role credentials always returns the version 2.0 credentials; the version 1.0 credentials are not available.  
*Required*: No  
*Type*: String  
*Allowed values*: `optional | required`  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)