ALIYUN::ECS::LaunchTemplate

Updated at:

The ALIYUN::ECS::LaunchTemplate resource creates an ECS launch template.

Syntax

{
  "Type": "ALIYUN::ECS::LaunchTemplate",
  "Properties": {
    "LaunchTemplateName": String,
    "VersionDescription": String,
    "ImageId": String,
    "InstanceType": String,
    "SecurityGroupId": String,
    "NetworkType": String,
    "VSwitchId": String,
    "InstanceName": String,
    "Description": String,
    "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,
    "TemplateResourceGroupId": String,
    "SecurityGroupIds": List,
    "ResourceGroupId": String,
    "SpotDuration": Integer,
    "ImageOwnerAlias": String,
    "Period": Integer,
    "Ipv6AddressCount": Integer,
    "PrivateIpAddress": String,
    "PasswordInherit": Boolean,
    "SystemDiskDeleteWithInstance": Boolean,
    "DeploymentSetId": String,
    "InstanceChargeType": String,
    "SystemDiskPerformanceLevel": String
  }
}

Properties

PropertyTypeRequiredUpdate allowedDescriptionConstraints
LaunchTemplateNameStringYesNoThe name of the launch template.The name must be 2 to 128 characters in length. It must start with a letter or a Chinese character. It cannot start with http:// or https://. It can contain letters, Chinese characters, digits, colons (:), underscores (_), and hyphens (-).
VersionDescriptionStringNoNoThe description of the launch template version.The description must be 2 to 128 characters in length. It must start with a letter or a Chinese character. It cannot start with http:// or https://.
ImageIdStringNoNoThe ID of the image.None
InstanceTypeStringNoNoThe instance type.None
SecurityGroupIdStringNoNoThe ID of the security group.None
NetworkTypeStringNoNoThe network type of the instance.Valid values:
  • classic: The classic network.
  • vpc: The virtual private cloud (VPC).
VSwitchIdStringNoNoThe ID of the vSwitch.This parameter is valid only when NetworkType is set to vpc.
InstanceNameStringNoNoThe name of the instance.The name must be 2 to 128 characters in length. It must start with a letter or a Chinese character. It cannot start with http:// or https://.
DescriptionStringNoNoThe description of the instance.The description must be 2 to 128 characters in length. It must start with a letter or a Chinese character. It cannot start with http:// or https://.
InternetMaxBandwidthOutIntegerNoNoThe maximum outbound public bandwidth.The value must be an integer from 0 to 100.

Unit: Mbit/s.

HostNameStringNoNoThe hostname of the instance.

A period (.) or a hyphen (-) cannot be used as the first or last character. These characters also cannot be used consecutively.

Valid values:
  • For Windows instances, the hostname must be 2 to 15 characters in length. It cannot be all digits. It can contain letters, digits, and hyphens (-).
  • For other instance types such as Linux, the hostname must be 2 to 64 characters in length. It can contain letters, digits, and hyphens (-).
ZoneIdStringNoNoThe ID of the zone where the instance is located.None
SystemDiskCategoryStringNoNoThe category of the system disk.Valid values:
  • cloud: basic disk.
  • cloud_efficiency: ultra disk.
  • cloud_ssd: Specifies a standard SSD.
  • ephemeral_ssd: local SSD.
SystemDiskSizeNumberNoNoThe size of the system disk.The value must be an integer from 20 to 500.

Unit: GB.

SystemDiskDiskNameStringNoNoThe name of the system disk.The name must be 2 to 128 characters in length. It must start with a letter or a Chinese character. It cannot start with http:// or https://. It can contain letters, Chinese characters, digits, colons (:), underscores (_), and hyphens (-).
SystemDiskDescriptionStringNoNoThe description of the system disk.The description must be 2 to 256 characters in length. It cannot start with http:// or https://.
IoOptimizedStringNoNoSpecifies whether the instance is an I/O optimized instance.Valid values:
  • none: The instance is not I/O optimized.
  • optimized: The instance is I/O optimized.
InternetChargeTypeStringNoNoThe billing method for network usage.Valid values:
  • PayByBandwidth: pay-by-bandwidth.
  • PayByTraffic: pay-by-data-transfer.
UserDataStringNoNoUser data for the instance.The user data must be Base64-encoded. The raw data cannot exceed 16 KB.
KeyPairNameStringNoNoThe name of the key pair.This parameter is required only for Linux instances. If you specify this parameter, the password-based logon method is disabled.
RamRoleNameStringNoNoThe name of the instance RAM role.None
AutoReleaseTimeStringNoNoThe automatic release time of the instance.The time must be in the yyyy-MM-ddTHH:mm:ssZ format and in UTC. The time follows the ISO 8601 standard.
SpotStrategyStringNoNoSpecifies the preemption policy for pay-as-you-go instances.

This parameter is valid only when InstanceChargeType is set to PostPaid.

Valid values:

  • NoSpot: A regular pay-as-you-go instance.
  • SpotWithPriceLimit: A spot instance for which you specify a maximum price.
  • SpotAsPriceGo: A spot instance for which the system automatically bids at a price up to the pay-as-you-go price.
SpotPriceLimitStringNoNoThe maximum hourly price of the instance.The value can have up to three decimal places.
SecurityEnhancementStrategyStringNoNoSpecifies whether to enable security hardening.Valid values:
  • Active: The item is enabled.
  • Deactivated: Shut down.
DiskMappingsListNoNoThe list of data disks.You can add up to 16 data disks.

For more information, see the DiskMappings property.

NetworkInterfacesListNoNoThe list of elastic network interfaces (ENIs).You can add up to 8 ENIs.

For more information, see the NetworkInterfaces property.

TagsListNoNoThe list of tags for the instance, security group, disks, and ENIs.You can add up to 20 tags.

For more information, see the Tags property.

TemplateTagsListNoNoThe list of tags for the launch template.You can add up to 20 tags.

For more information, see the TemplateTags property.

TemplateResourceGroupIdStringNoNoThe ID of the resource group to which the launch template belongs.None
SecurityGroupIdsListNoNoOne or more security groups to which the instance belongs.The number of security groups is determined by the quota.
Note You cannot specify both SecurityGroupId and SecurityGroupIds.
ResourceGroupIdStringNoNoThe ID of the resource group to which the instance, block storage, and ENIs belong.None
SpotDurationIntegerNoNoThe retention period for the spot instance.The value must be an integer from 0 to 6.

Default value: 1.

Unit: hours.

Note To set the value to an integer from 2 to 6, submit a ticket.
ImageOwnerAliasStringNoNoThe source of the image.Valid values:
  • system: public images provided by Alibaba Cloud.
  • self: custom images that you created.
  • others: images shared by other Alibaba Cloud users.
  • Marketplace: The image marketplace.
PeriodIntegerNoNoThe subscription duration of the resource.This parameter is required and valid only when InstanceChargeType is set to PrePaid.

Valid values: 1 to 9, 12, 24, 36, 48, and 60.

Unit: months.

Ipv6AddressCountIntegerNoNoThe number of randomly generated IPv6 addresses to assign to the primary ENI.The value must be an integer from 1 to 10.
PrivateIpAddressStringNoNoThe private IP address of the instance.When you set the private IP address for an ECS instance in a VPC, you must select an idle CIDR block from the vSwitch.
PasswordInheritBooleanNoNoSpecifies whether to use the preset password of the image.Valid values:
  • true: Enabled
  • false: This value is not used.
Note You must specify either PasswordInherit or Password.
SystemDiskDeleteWithInstanceBooleanNoNoSpecifies whether to release the system disk when the instance is released.Valid values:
  • true (default): The instance is released.
  • false: Does not release.
DeploymentSetIdStringNoNoThe ID of the deployment set.None
InstanceChargeTypeStringNoNoThe billing method of the instance.Valid values:
  • PrePaid: subscription.
  • PostPaid: pay-as-you-go.
SystemDiskPerformanceLevelStringNoNoThe performance level of the ESSD that you use as the system disk.Valid values:
  • PL0 (default): A single disk can deliver up to 10,000 random read/write IOPS.
  • PL1: A single disk can deliver up to 50,000 random read/write IOPS.
  • PL2: A single disk can deliver up to 100,000 random read/write IOPS.
  • PL3: A single disk can deliver up to 1,000,000 random read/write IOPS.

DiskMappings syntax

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

DiskMappings properties

PropertyTypeRequiredUpdate allowedDescriptionConstraints
CategoryStringNoNoThe category of the data disk.Valid values:
  • cloud: basic disk.
  • cloud_efficiency: ultra disk.
  • cloud_ssd: Standard SSD.
  • ephemeral_ssd: local SSD.
DiskNameStringNoNoThe name of the data disk.The name must be 2 to 128 characters in length. It must start with a letter or a Chinese character. It cannot start with http:// or https://. It can contain letters, Chinese characters, digits, colons (:), underscores (_), and hyphens (-).
DescriptionStringNoNoThe description of the data disk.The description must be 2 to 256 characters in length. It cannot start with http:// or https://.
SnapshotIdStringNoNoThe snapshot used to create the data disk.None
SizeStringNoNoSystem disk size

Valid values:

  • cloud: 5 to 2000.
  • cloud_efficiency: 20 to 32768.
  • cloud_ssd: 20 to 32768.
  • ephemeral_ssd: 5 to 800.

Unit: GB.

EncryptedBooleanNoNoSpecifies whether to encrypt the data disk.Valid values:
  • true: Encryption is enabled.
  • false: The data is not encrypted.
DeleteWithInstanceBooleanNoNoSpecifies whether to release the data disk when the instance is released.Valid values:
  • true: Triggers a release.
  • false: Does not release the data disk.
PerformanceLevelStringNoNoThe performance level of the ESSD that you use as the data disk.Valid values:
  • PL0 (default): A single disk can deliver up to 10,000 random read/write IOPS.
  • PL1: A single disk can deliver up to 50,000 random read/write IOPS.
  • PL2: A single disk can deliver up to 100,000 random read/write IOPS.
  • PL3: A single disk can deliver up to 1,000,000 random read/write IOPS.

NetworkInterfaces syntax

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

NetworkInterfaces properties

Property NameTypeRequiredUpdate allowedDescriptionConstraints
PrimaryIpAddressStringNoNoThe primary private IP address of the ENI.None
VSwitchIdStringNoNoThe ID of the vSwitch to which the ENI belongs.None
SecurityGroupIdStringNoNoThe ID of the security group to which the ENI belongs.None
NetworkInterfaceNameStringNoNoThe name of the ENI.None
DescriptionStringNoNoThe description of the ENI.The description must be 2 to 256 characters in length. It cannot start with http:// or https://.

Tags syntax

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

Tags properties

PropertyTypeRequiredUpdate allowedDescriptionConstraints
KeyStringNoNoThe key of the tag.The key must be 1 to 128 characters in length. It cannot start with aliyun or acs:. It cannot contain http:// or https://.
ValueStringNoNoThe value of the tag.The value can be up to 128 characters in length. It cannot start with aliyun or acs:. It cannot contain http:// or https://.

TemplateTags syntax

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

TemplateTags properties

PropertyTypeRequiredUpdate allowedDescriptionConstraints
KeyStringNoNoThe key of the tag.The value must be 1 to 128 characters long, must not start with aliyun or acs:, and must not contain http:// or https://.
ValueStringNoNoThe value of the tag.The value can be up to 128 characters in length. It cannot start with aliyun or acs:. It cannot contain http:// or https://.

Return values

Fn::GetAtt

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

Examples

  • YAML format

    ROSTemplateFormatVersion: '2015-09-01'
    Description: Test ECS LaunchTemplate
    Parameters:
      VSwitchId:
        Type: String
        AssociationProperty: ALIYUN::ECS::VSwitch::VSwitchId
      SecurityGroupId:
        AssociationProperty: ALIYUN::ECS::SecurityGroup::SecurityGroupId
        Type: String
    Resources:
      LaunchTemplate:
        Type: ALIYUN::ECS::LaunchTemplate
        Properties:
          LaunchTemplateName: mytest
          VersionDescription: Test create LaunchTemplate
          ImageId: centos_7
          InstanceType: ecs.c5.large
          SystemDiskCategory: cloud_essd
          SecurityGroupId:
            Ref: SecurityGroupId
          VSwitchId:
            Ref: VSwitchId
    Outputs: {}
  • JSON format

    {
      "ROSTemplateFormatVersion": "2015-09-01",
      "Description": "Test ECS LaunchTemplate",
      "Parameters": {
        "VSwitchId": {
          "Type": "String",
          "AssociationProperty": "ALIYUN::ECS::VSwitch::VSwitchId"
        },
        "SecurityGroupId": {
          "AssociationProperty": "ALIYUN::ECS::SecurityGroup::SecurityGroupId",
          "Type": "String"
        }
      },
      "Resources": {
        "LaunchTemplate": {
          "Type": "ALIYUN::ECS::LaunchTemplate",
          "Properties": {
            "LaunchTemplateName": "mytest",
            "VersionDescription": "Test create LaunchTemplate",
            "ImageId": "centos_7",
            "InstanceType": "ecs.c5.large",
            "SystemDiskCategory": "cloud_essd",
            "SecurityGroupId": {
              "Ref": "SecurityGroupId"
            },
            "VSwitchId": {
              "Ref": "VSwitchId"
            }
          }
        }
      },
      "Outputs": {
      }
    }

For more examples that use an ECS launch template with an auto provisioning group, see the JSON example and YAML example.