ALIYUN::ECS::LaunchTemplate is used to create a launch template for creating ECS instances.

Syntax

{
  "Type": "ALIYUN::ECS::LaunchTemplate",
  "Properties": {
    "LaunchTemplateName": String,
    "VersionDescription": String,
    "ImageId": String,
    "InstanceType": String,
    "SecurityGroupId": String,
    "NetworkType": String,
    "VSwitchId": String,
    "InstanceName": String,
    "Description": String,
    "InternetMaxBandwidthIn": Integer,
    "InternetMaxBandwidthOut": Integer,
    "HostName": String,
    "ZoneId": String,
    "SystemDiskCategory": String,
    "SystemDiskSize": Number,
    "SystemDiskDiskName": String,
    "SystemDiskDescription": String,
    "IoOptimized": String,
    "InternetChargeType": String,
    "UserData": String,
    "KeyPairName": String,
    "RamRoleName": String,
    "AutoReleaseTime": String,
    "SpotStrategy": String,
    "SpotPriceLimit": String,
    "SecurityEnhancementStrategy": String,
    "DiskMappings": List,
    "NetworkInterfaces": List,
    "Tags": List,
    "TemplateTags": List
  }
}

Properties

Name Type Required Editable Description Validity
LaunchTemplateName String Yes No The name of the launch template. The name must be 2 to 128 characters in length and can contain letters, digits, colons (:), underscores (_), and hyphens (-). It must start with a letter and cannot start with http:// or https://.
VersionDescription String No No The description of the launch template version. The description must be 2 to 256 characters in length and cannot start with http:// or https://.
ImageId String No No The ID of the image. None
InstanceType String No No The type of the ECS instance. None
SecurityGroupId String No No The ID of the security group. None
NetworkType String No No The network type of the instance.

Valid values:

classic

vpc

VSwitchId String No No The ID of the VSwitch. If you are creating an instance in a VPC, you must specify this parameter. None
InstanceName String No No The name of the instance. The name must be 2 to 128 characters in length and can contain letters, digits, colons (:), underscores (_), and hyphens (-). It must start with a letter and cannot start with http:// or https://.
Description String No No The description of the instance. The description must be 2 to 256 characters in length and cannot start with http:// or https://.
InternetMaxBandwidthIn Integer No No The maximum bandwidth of the inbound traffic from the Internet. Unit: Mbit/s. Valid values: 1 to 200.
InternetMaxBandwidthOut Integer No No The maximum bandwidth of the outbound traffic to the Internet. Unit: Mbit/s. Valid values: 0 to 100.
HostName String No No The hostname of the instance.

The hostname cannot start or end with a period (.) or a hyphen (-). It cannot contain consecutive periods (.) or hyphens (-).

For Windows-based instances:

The hostname must be 2 to 15 characters in length and can contain letters, digits, and hyphens (-). It cannot contain periods (.) and cannot contain only digits.

For other instances such as Linux-based instances:

The hostname must be 2 to 64 characters in length and can contain letters, digits, hyphens (-), and periods (.). You can use periods (.) to separate a name into multiple segments.

ZoneId String No No The ID of the zone to which the instance belongs. None
SystemDiskCategory String No No The type of the system disk. Valid values:

cloud: basic disk

cloud_efficiency: ultra disk

cloud_ssd: standard SSD

ephemeral_ssd: local SSD

SystemDiskSize Number No No The size of the system disk. Unit: GiB. Valid values: 20 to 500.
SystemDiskDiskName String No No The name of the system disk. The name must be 2 to 128 characters in length and can contain letters, digits, colons (:), underscores (_), and hyphens (-). It must start with a letter and cannot start with http:// or https://.
SystemDiskDescription String No No The description of the system disk. The description must be 2 to 256 characters in length and cannot start with http:// or https://.
IoOptimized String No No Specifies whether the instance is I/O optimized.

Valid values:

none: The instance is not I/O optimized.

optimized: The instance is I/O optimized.

InternetChargeType String No No The billing method for network usage.

Valid values:

PayByBandwidth

PayByTraffic

UserData String No No The user data of the instance. The user data must be encoded in Base64. The maximum size of the raw data is 16 KB.
KeyPairName String No No The name of the key pair. For Windows-based instances, ignore this parameter. This parameter is empty by default. The Password parameter still takes effect even when the KeyPairName parameter is specified. For Linux-based instances, password authentication is disabled if this parameter is specified.
RamRoleName String No No The RAM role name of the instance. None
AutoReleaseTime String No No The time scheduled for the instance to be automatically released. Specify the time in the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time must be in UTC.
SpotStrategy String No No The preemption policy for pay-as-you-go instances.

This parameter takes effect only when the InstanceChargeType parameter is set to PostPaid.

Valid values:

NoSpot: applies to regular pay-as-you-go instances.

SpotWithPriceLimit: applies to preemptible instances with a maximum hourly price.

SpotAsPriceGo: applies to pay-as-you-go instances priced at the market price at the time of purchase.

SpotPriceLimit String No No The maximum hourly price of the instance. Three decimal places are allowed at most.
SecurityEnhancementStrategy String No No Specifies whether to enable security enhancement.

Valid values:

Active: enables security enhancement.

Deactive: disables security enhancement.

DiskMappings List No No The list of data disks. A maximum of 16 data disks can be specified.
NetworkInterfaces List No No The list of ENIs. A maximum of eight ENIs can be specified.
Tags List No No The tags of an instance, a security group, a disk, or an ENI. A maximum of 20 tags can be specified.
TemplateTags List No No The tags of the launch template. A maximum of 20 tags can be specified.

DiskMappings syntax

"DiskMappings": [
  {
    "Category": String,
    "DiskName": String,
    "Description": String,
    "SnapshotId": String,
    "Size": String,
    "Encrypted": String,
    "DeleteWithInstance": String
  }
]

DiskMappings properties

Name Type Required Editable Description Validity
Category String No No The type of the data disk.

Valid values:

cloud: basic disk

cloud_efficiency: ultra disk

cloud_ssd: standard SSD

ephemeral_ssd: local SSD

DiskName String No No The name of the data disk. The name must be 2 to 128 characters in length and can contain letters, digits, colons (:), underscores (_), and hyphens (-). It must start with a letter and cannot start with http:// or https://.
Description String No No The description of the data disk. The description must be 2 to 256 characters in length and cannot start with http:// or https://.
SnapshotId String No No The ID of the snapshot used to create the data disk. None
Size String No No The size of the system disk. Unit: GiB.

The size of the system disk varies with the system disk type.

Valid values when the Category parameter is set to cloud: 5 to 2000.

Valid values when the Category parameter is set to cloud_efficiency: 20 to 32768.

Valid values when the Category parameter is set to cloud_ssd: 20 to 32768.

Valid values when the Category parameter is set to ephemeral_ssd: 5 to 800.

Encrypted Boolean No No Specifies whether to encrypt the data disk. None
DeleteWithInstance Boolean No No Specifies whether to release the data disk when the instance is released. None

NetworkInterfaces syntax

"NetworkInterfaces": [
  {
    "PrimaryIpAddress": String,
    "VSwitchId": String,
    "SecurityGroupId": String,
    "NetworkInterfaceName": String,
    "Description": String
  }
]

NetworkInterfaces properties

Name Type Required Editable Description Validity
PrimaryIpAddress String No No The primary private IP address of the ENI. None
VSwitchId String No No The ID of the VSwitch to which the ENI belongs. None
SecurityGroupId String No No The ID of the security group to which the ENI belongs. None
NetworkInterfaceName String No No The name of the ENI. None
Description String No No The description of the ENI. The description must be 2 to 256 characters in length and cannot start with http:// or https://.

Tags syntax

"Tags": [
  {
    "Value": String,
    "Key": String
  }
]

Tags properties

Name Type Required Editable Description Validity
key String Yes No None None
value String No No None None

TemplateTags syntax

"TemplateTags": [
  {
    "Value": String,
    "Key": String
  }
]

TemplateTags properties

Name Type Required Editable Description Validity
key String Yes No None None
value String No No None None

Response parameters

Fn::GetAtt
  • LaunchTemplateId: the ID of the instance launch template.
  • LaunchTemplateName: the name of the instance launch template.
  • DefaultVersionNumber: the default version number of the instance launch template.
  • LatestVersionNumber: the latest version number of the instance launch template.

Examples

{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Resources": {
    "Template1": {
      "Type": "ALIYUN::ECS::LaunchTemplate",
      "Properties": {
        "LaunchTemplateName": "MyTemplate",
        "VersionDescription": "Launch template with all properties set",
        "ImageId": "m-2ze9uqi7wo61hwep5q52",
        "InstanceType": "ecs.n4.small",
        "SecurityGroupId": "sg-2ze8yxgempcdsq3iucsi",
        "NetworkType": "vpc",
        "VSwitchId": "vsw-2zei67xd9nhcqxzec7qt7",
        "InstanceName": "InstanceName",
        "Description": "Description of template",
        "InternetMaxBandwidthIn": 100,
        "InternetMaxBandwidthOut": 200,
        "HostName": "tttinfo",
        "ZoneId": "cn-beijing-a",
        "SystemDiskCategory": "cloud_ssd",
        "SystemDiskSize": "40",
        "SystemDiskDiskName": "TheSystemDiskName",
        "SystemDiskDescription": "The system disk description",
        "IoOptimized": "optimized",
        "InternetChargeType": "PayByBandwidth",
        "UserData": "dGhpcyBpcyBhIHVzZXIgZGF0YSBleG1hcGxl",
        "KeyPairName": "ThisIsKeyPair",
        "RamRoleName": "ThisIsRamRole",
        "AutoReleaseTime": "2050-10-01T00:00:00Z",
        "SpotStrategy": "SpotWithPriceLimit",
        "SpotPriceLimit": "100.001",
        "SecurityEnhancementStrategy": "Active",
        "DiskMappings": [
          {
            "Category": "cloud_ssd",
            "Size": 40,
            "SnapshotId": "s-2ze1fr2bipove27bn9mz",
            "Encrypted": true,
            "DiskName": "dataDisk1",
            "Description": "I am data disk 1",
            "DeleteWithInstance": true
      },
      {
            "Category": "cloud_efficiency",
            "Size": 20,
            "SnapshotId": "s-2ze4k0w8b33mlsqu4tl6",
            "Encrypted": false,
            "DiskName": "dataDisk2",
            "Description": "I am data disk 2",
            "DeleteWithInstance": true
       }
     ],
     "NetworkInterfaces": [
       {
            "PrimaryIpAddress": "10.10.1.1",
            "VSwitchId": "vsw-2zetgeiqlemyok9z5j2em",
            "SecurityGroupId": "sg-2ze8yxgempcdsq3iucsi",
            "NetworkInterfaceName": "my-eni1",
            "Description": "My eni 1"
        },
     ],
     "Tags": [
          {
            "Key": "key1",
            "Value": "value1"
          },
          {
            "Key": "key2",
            "Value": "value2"
          }
         ],
     "TemplateTags": [
       {
            "Key": "templateKey1",
            "Value": "templateValue1"
             },
           {
            "Key": "templateKey2",
            "Value": "templateValue2"
           }
       ]
       }
     }
  },
  "Outputs": {
      "LaunchTemplateId": {
          "Value": {"Fn::GetAtt": ["Template1","LaunchTemplateId"]}
    },
   "LaunchTemplateName": {
        "Value": {"Fn::GetAtt": ["Template1","LaunchTemplateName"]}
    },
   "DefaultVersionNumber": {
          "Value": {"Fn::GetAtt": ["Template1","DefaultVersionNumber"]}
    },
   "LatestVersionNumber": {
          "Value": {"Fn::GetAtt": ["Template1","LatestVersionNumber"]}
    }
  }
}