ALIYUN::ECS::LaunchTemplate is used to create a launch template. You can use a launch template to create an Elastic Compute Service (ECS) instance.
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
Property | Type | Required | Editable | Description | Constraint |
---|---|---|---|---|---|
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 (-). The name must start with a letter but cannot start with http:// or https:// . |
VersionDescription | String | No | No | The description of the launch template version. | The description must be 2 to 128 characters in length. The description must start with a letter but cannot start with http:// or https:// . |
ImageId | String | No | No | The ID of the image. | None. |
InstanceType | String | No | No | The instance type. | None. |
SecurityGroupId | String | No | No | The ID of the security group. | None. |
NetworkType | String | No | No | The network type of the instance. | Valid values:
|
VSwitchId | String | No | No | The ID of the vSwitch. | This property takes effect when you set the NetworkType property to vpc . |
InstanceName | String | No | No | The name of the instance. | The name must be 2 to 128 characters in length. The name must start with a letter but cannot start with http:// or https:// . |
Description | String | No | No | The description of the instance. | The description must be 2 to 128 characters in length. The description must start with a letter but cannot start with http:// or https:// . |
InternetMaxBandwidthOut | Integer | No | No | The maximum outbound public bandwidth. | Valid values: 0 to 100. Unit: Mbit/s. |
HostName | String | No | No | The hostname of the instance. | The hostname cannot start or end with a period (.) or hyphen (-), or contain consecutive periods (.) or hyphens (-). The hostname must meet the following requirements:
|
ZoneId | String | No | No | The ID of the zone to which the instance belongs. | None. |
SystemDiskCategory | String | No | No | The category of the system disk. | Valid values:
|
SystemDiskSize | Number | No | No | The size of the system disk. | Valid values: 20 to 500. Unit: GB. |
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 (-). The name must start with a letter but 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. The description cannot start with http:// or https:// . |
IoOptimized | String | No | No | Specifies whether the instance is an I/O optimized instance. | Valid values:
|
InternetChargeType | String | No | No | The metering method for network usage. | Valid values:
|
UserData | String | No | No | The user data of the instance. | User data must be Base64-encoded. The maximum size of raw data is 16 KB. |
KeyPairName | String | No | No | The name of the key pair. | This property is required only for Linux instances. By default, the password-based logon is disabled for Linux instances. |
RamRoleName | String | No | No | The name of the RAM role for the instance. | None. |
AutoReleaseTime | String | No | No | The time at which the system automatically releases the instance. | 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 a pay-as-you-go instance. | This property takes effect when you set the InstanceChargeType property to PostPaid. Valid values:
|
SpotPriceLimit | String | No | No | The maximum hourly price for the instance. | The value of this property can contain up to three decimal places. |
SecurityEnhancementStrategy | String | No | No | Specifies whether to enable security hardening. | Valid values:
|
DiskMappings | List | No | No | The data disks. | You can attach up to 16 data disks. For more information, see DiskMappings properties. |
NetworkInterfaces | List | No | No | The elastic network interfaces (ENIs). | You can attach up to eight ENIs. For more information, see NetworkInterfaces properties. |
Tags | List | No | No | The tags of the instance, security group, disk, and ENI. | You can specify up to 20 tags for the instance, security group, disk, or ENI. For more information, see Tags properties. |
TemplateTags | List | No | No | The tags of the launch template. | You can add up to 20 tags. For more information, see TemplateTags properties. |
TemplateResourceGroupId | String | No | No | The ID of the resource group to which the launch template belongs. | None. |
SecurityGroupIds | List | No | No | The IDs of one or more security groups to which you want to add the instance. | The value of this property varies based on the maximum number of security groups to which you can add the instance. Note You cannot specify both the SecurityGroupId and SecurityGroupIds properties. |
ResourceGroupId | String | No | No | The ID of the resource group to which the instance, Elastic Block Storage (EBS) device, and ENI belong. | None. |
SpotDuration | Integer | No | No | The retention period of the preemptible instance. | Valid values: 0 to 6. Default value: 1. Unit: hours. Note If you want to set the value to 2 to 6, you must submit a ticket. |
ImageOwnerAlias | String | No | No | The source of the image. | Valid values:
|
Period | Integer | No | No | The subscription duration of the launch template. | This property takes effect and is required when you set the InstanceChargeType property to PrePaid. Valid values: 1, 2, 3, 4, 5, 6, 7, 8, 9, 12, 24, 36, 48, and 60. Unit: months. |
Ipv6AddressCount | Integer | No | No | The number of IPv6 addresses that the system randomly generates for the primary ENI. | Valid values: 1 to 10. |
PrivateIpAddress | String | No | No | The private IP address of the instance. | If you configure a private IP address for an ECS instance of the VPC type, you must select an idle IP address from the CIDR block of the vSwitch. |
PasswordInherit | Boolean | No | No | Specifies whether to use the preset password of the image. | Valid values:
Note You must specify only one of the PasswordInherit and Password properties. |
SystemDiskDeleteWithInstance | Boolean | No | No | Specifies whether to release the system disk when the instance is released. | Default value: true. Valid values:
|
DeploymentSetId | String | No | No | The ID of the deployment set. | None. |
InstanceChargeType | String | No | No | The billing method of the instance. | Valid values:
|
SystemDiskPerformanceLevel | String | No | No | The performance level (PL) of the enhanced SSD (ESSD) that is used as the system disk. | Default value: PL0. Valid values:
|
DiskMappings syntax
"DiskMappings": [
{
"Category": String,
"DiskName": String,
"Description": String,
"SnapshotId": String,
"Size": String,
"Encrypted": String,
"DeleteWithInstance": String,
"PerformanceLevel": String
}
]
DiskMappings properties
Property | Type | Required | Editable | Description | Constraint |
---|---|---|---|---|---|
Category | String | No | No | The category of the data disk. | Valid values:
|
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 (-). The name must start with a letter but 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. The name cannot start with http:// or https:// . |
SnapshotId | String | No | No | The ID of the snapshot that is used to create the data disk. | None. |
Size | String | No | No | The size of the system disk. | Valid values:
Unit: GB. |
Encrypted | Boolean | No | No | Specifies whether to encrypt the data disk. | Valid values:
|
DeleteWithInstance | Boolean | No | No | Specifies whether to release the data disk when the instance is released. | Valid values:
|
PerformanceLevel | String | No | No | The PL of the ESSD that is used as the data disk. | Default value: PL0. Valid values:
|
NetworkInterfaces syntax
"NetworkInterfaces": [
{
"PrimaryIpAddress": String,
"VSwitchId": String,
"SecurityGroupId": String,
"NetworkInterfaceName": String,
"Description": String
}
]
NetworkInterfaces properties
Property | Type | Required | Editable | Description | Constraint |
---|---|---|---|---|---|
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. The description cannot start with http:// or https:// . |
Tags syntax
"Tags": [
{
"Value": String,
"Key": String
}
]
Tags properties
Property | Type | Required | Editable | Description | Constraint |
---|---|---|---|---|---|
Key | String | No | No | The key of the tag. | The key must be 1 to 128 characters in length, and cannot contain http:// or https:// . The key cannot start with aliyun or acs: . |
Value | String | No | No | The value of the tag. | The value can be up to 128 characters in length, and cannot contain http:// or https:// . The value cannot start with aliyun or acs: . |
TemplateTags syntax
"TemplateTags": [
{
"Value": String,
"Key": String
}
]
TemplateTags properties
Property | Type | Required | Editable | Description | Constraint |
---|---|---|---|---|---|
Key | String | No | No | The key of the tag. | The key must be 1 to 128 characters in length, and cannot contain http:// or https:// . The key cannot start with aliyun or acs: . |
Value | String | No | No | The value of the tag. | The value can be up to 128 characters in length, and cannot contain http:// or https:// . The value cannot start with aliyun or acs: . |
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
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, visit LaunchTemplate.json and LaunchTemplate.yml. In the examples, the ALIYUN::ECS::LaunchTemplate and ALIYUN::ECS::AutoProvisioningGroup resource types are used.