ALIYUN::ECS::LaunchTemplate类型用于创建ECS实例启动模板。
语法
{
"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
}
}
属性
属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 |
---|---|---|---|---|---|
LaunchTemplateName | String | 是 | 否 | 实例启动模板名称。 | 长度为2~128个字符。必须以英文字母或汉字开头,不能以http:// 和https:// 开头。可包含英文字母、汉字、数字、半角冒号(:)、下划线(_)和短划线(-)。
|
VersionDescription | String | 否 | 否 | 实例启动模板版本描述。 | 长度为2~128个字符。必须以英文字母或汉字开头,不能以http:// 和https:// 开头。
|
ImageId | String | 否 | 否 | 镜像ID。 | 无 |
InstanceType | String | 否 | 否 | 实例类型。 | 无 |
SecurityGroupId | String | 否 | 否 | 安全组ID。 | 无 |
NetworkType | String | 否 | 否 | 实例网络类型。 | 取值:
|
VSwitchId | String | 否 | 否 | 创建VPC类型实例时需要指定虚拟交换机ID。 | 无 |
InstanceName | String | 否 | 否 | 实例名称。 | 长度为2~128个字符。必须以英文字母或汉字开头,不能以http:// 和https:// 开头。
|
Description | String | 否 | 否 | 实例描述。 | 长度为2~128个字符。必须以英文字母或汉字开头,不能以http:// 和https:// 开头。
|
InternetMaxBandwidthIn | Integer | 否 | 否 | 公网入带宽最大值。 | 取值范围:1~200。
单位:Mbps。 |
InternetMaxBandwidthOut | Integer | 否 | 否 | 公网出带宽最大值。 | 取值范围:0~100。
单位:Mbps。 |
HostName | String | 否 | 否 | 实例主机名。 |
英文句点(.)和短划线(-)不能作为首尾字符,也不能连续使用。 取值要求:
|
ZoneId | String | 否 | 否 | 实例所属的可用区ID。 | 无 |
SystemDiskCategory | String | 否 | 否 | 系统盘的磁盘种类。 | 取值:
|
SystemDiskSize | Number | 否 | 否 | 系统盘大小。 | 取值范围:20~500。
单位:GB。 |
SystemDiskDiskName | String | 否 | 否 | 系统盘名称。 | 长度为2~128个字符。必须以英文字母或汉字开头,不能以http:// 和https:// 开头。可包含英文字母、汉字、数字、半角冒号(:)、下划线(_)和短划线(-)。
|
SystemDiskDescription | String | 否 | 否 | 系统盘描述。 | 长度为2~256个字符,不能以http:// 和https:// 开头。
|
IoOptimized | String | 否 | 否 | 是否为I/O优化实例。 | 取值:
|
InternetChargeType | String | 否 | 否 | 网络付费类型。 | 取值:
|
UserData | String | 否 | 否 | 实例自定义数据。 | 需要以Base64方式编码,原始数据最多为16 KB。 |
KeyPairName | String | 否 | 否 | 密钥对名称。 | 取值要求:
|
RamRoleName | String | 否 | 否 | 实例RAM角色名称。 | 无 |
AutoReleaseTime | String | 否 | 否 | 实例自动释放时间。 | 按照ISO8601标准表示。需要使用UTC时间,格式为yyyy-MM-ddTHH:mm:ssZ 。
|
SpotStrategy | String | 否 | 否 | 后付费实例的抢占策略。 |
当创建实例接口中的InstanceChargeType参数取值为PostPaid时生效。 取值:
|
SpotPriceLimit | String | 否 | 否 | 设置实例的每小时最高价格。 | 支持最多3位小数。 |
SecurityEnhancementStrategy | String | 否 | 否 | 是否开启安全加固。 | 取值:
|
DiskMappings | List | 否 | 否 | 数据盘列表。 | 最多支持16个数据盘。
详情请参见DiskMappings属性。 |
NetworkInterfaces | List | 否 | 否 | 弹性网卡列表。 | 最多支持8个弹性网卡。
详情请参见NetworkInterfaces属性。 |
Tags | List | 否 | 否 | 实例、安全组、磁盘和网卡的标签列表。 | 最多支持20个标签。
详情请参见Tags属性。 |
TemplateTags | List | 否 | 否 | 启动模板的标签列表。 | 最多支持20个标签。
详情请参见TemplateTags属性。 |
DiskMappings语法
"DiskMappings": [
{
"Category": String,
"DiskName": String,
"Description": String,
"SnapshotId": String,
"Size": String,
"Encrypted": String,
"DeleteWithInstance": String
}
]
DiskMappings属性
属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 |
---|---|---|---|---|---|
Category | String | 否 | 否 | 数据盘的磁盘种类。 | 取值:
|
DiskName | String | 否 | 否 | 数据盘名称。 | 长度为2~128个字符。必须以英文字母或汉字开头,不能以http:// 和https:// 开头。可包含英文字母、汉字、数字、半角冒号(:)、下划线(_)和短划线(-)。
|
Description | String | 否 | 否 | 数据盘描述。 | 长度为2~256个字符,不能以http:// 和https:// 开头。
|
SnapshotId | String | 否 | 否 | 创建数据盘使用的快照。 | 无 |
Size | String | 否 | 否 | 系统盘大小 |
取值:
单位:GB。 |
Encrypted | Boolean | 否 | 否 | 是否加密数据盘。 | 无 |
DeleteWithInstance | Boolean | 否 | 否 | 数据盘是否随实例释放而释放。 | 无 |
NetworkInterfaces语法
"NetworkInterfaces": [
{
"PrimaryIpAddress": String,
"VSwitchId": String,
"SecurityGroupId": String,
"NetworkInterfaceName": String,
"Description": String
}
]
NetworkInterfaces属性
属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 |
---|---|---|---|---|---|
PrimaryIpAddress | String | 否 | 否 | 弹性网卡的主私有IP地址。 | 无 |
VSwitchId | String | 否 | 否 | 弹性网卡所属的虚拟交换机ID。 | 无 |
SecurityGroupId | String | 否 | 否 | 弹性网卡所属的安全组ID。 | 无 |
NetworkInterfaceName | String | 否 | 否 | 弹性网卡名称。 | 无 |
Description | String | 否 | 否 | 弹性网卡描述信息。 | 长度为2~256个字符,不能以http:// 和https:// 开头。
|
Tags语法
"Tags": [
{
"Value": String,
"Key": String
}
]
Tags属性
属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 |
---|---|---|---|---|---|
Key | String | 否 | 否 | 标签键。 | 长度为1~128个字符,不能以aliyun 和acs: 开头,不能包含http:// 或者https:// 。
|
Value | String | 否 | 否 | 标签值。 | 长度为0~128个字符,不能以aliyun 和acs: 开头,不能包含http:// 或者https:// 。
|
TemplateTags语法
"TemplateTags": [
{
"Value": String,
"Key": String
}
]
TemplateTags属性
属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 |
---|---|---|---|---|---|
Key | String | 否 | 否 | 标签键 | 长度为1~128个字符,不能以aliyun 和acs: 开头,不能包含http:// 或者https:// 。
|
Value | String | 否 | 否 | 标签值 | 长度为0~128个字符,不能以aliyun 和acs: 开头,不能包含http:// 或者https:// 。
|
返回值
Fn::GetAtt
- LaunchTemplateId: 实例启动模板ID。
- LaunchTemplateName:实例启动模板名称。
- DefaultVersionNumber:实例启动模板默认版本号。
- LatestVersionNumber:实例启动模板最新版本号。
示例
JSON
格式
{
"ROSTemplateFormatVersion": "2015-09-01",
"Parameters": {
"Description": {
"Type": "String",
"Description": "Description of the instance, [2, 256] characters."
},
"DiskMappings": {
"Type": "Json",
"Description": "Disk mappings to attach to instance. Max support 16 disks.",
"MaxLength": 16
},
"SystemDiskSize": {
"Type": "Number",
"Description": "Disk size of the system disk, range from 20 to 500 GB. If you specify with your own image, make sure the system disk size bigger than image size. ",
"MinValue": 20
},
"UserData": {
"Type": "String",
"Description": "User data to pass to instance. [1, 16KB] characters."
},
"SystemDiskDescription": {
"Type": "String",
"Description": "Description of created system disk."
},
"TemplateTags": {
"Type": "Json",
"Description": "Template tags to attach to launch template.",
"MaxLength": 20
},
"RamRoleName": {
"Type": "String",
"Description": "Instance RAM role name. The name is provided and maintained by Resource Access Management (RAM) and can be queried using ListRoles. For more information, see RAM API CreateRole and ListRoles."
},
"NetworkType": {
"Type": "String",
"Description": "Instance network type. Support 'vpc' and 'classic'",
"AllowedValues": [
"vpc",
"classic"
]
},
"NetworkInterfaces": {
"Type": "Json",
"Description": "Elastic network interfaces to be attached to instance.",
"MaxLength": 8
},
"ImageId": {
"Type": "String",
"Description": "Image ID to create ecs instance."
},
"SystemDiskDiskName": {
"Type": "String",
"Description": "Name of created system disk."
},
"SpotPriceLimit": {
"Type": "String",
"Description": "The hourly price threshold of a instance, and it takes effect only when parameter InstanceChargeType is PostPaid. Three decimals is allowed at most. "
},
"InstanceType": {
"Type": "String",
"Description": "Ecs instance supported instance type, make sure it should be correct."
},
"Tags": {
"Type": "Json",
"Description": "Tags to attach to instance, security group, disk and network interface.",
"MaxLength": 20
},
"HostName": {
"Type": "String",
"Description": "Host name of created ecs instance. at least 2 characters, and '.' '-' Is not the first and last characters as hostname, not continuous use. Windows platform can be up to 15 characters, allowing letters (without limiting case), numbers and '-', and does not support the number of points, not all is digital ('.').Other (Linux, etc.) platform up to 30 characters, allowing support number multiple points for the period between the points, each permit letters (without limiting case), numbers and '-' components."
},
"SpotStrategy": {
"Type": "String",
"Description": "The spot strategy of a Pay-As-You-Go instance, and it takes effect only when parameter InstanceChargeType is PostPaid. Value range: \"NoSpot: A regular Pay-As-You-Go instance\", \"SpotWithPriceLimit: A price threshold for a spot instance, \"\"SpotAsPriceGo: A price that is based on the highest Pay-As-You-Go instance. \"",
"AllowedValues": [
"NoSpot",
"SpotWithPriceLimit",
"SpotAsPriceGo"
]
},
"KeyPairName": {
"Type": "String",
"Description": "SSH key pair name."
},
"LaunchTemplateName": {
"Type": "String",
"Description": "The name of launch template."
},
"IoOptimized": {
"Type": "String",
"Description": "The 'optimized' instance can provide better IO performance. Support 'none' and 'optimized' only.",
"AllowedValues": [
"none",
"optimized"
]
},
"VersionDescription": {
"Type": "String",
"Description": "Description for version 1 of launch template."
},
"ZoneId": {
"Type": "String",
"Description": "Current zone to create the instance."
},
"VSwitchId": {
"Type": "String",
"Description": "The vSwitch Id to create ecs instance."
},
"SecurityGroupId": {
"Type": "String",
"Description": "Security group to create ecs instance. For classic instance need the security group not belong to VPC, for VPC instance, please make sure the security group belong to specified VPC."
},
"SystemDiskCategory": {
"Type": "String",
"Description": "Category of system disk. support cloud|cloud_efficiency|cloud_ssd|cloud_essd|ephemeral_ssd",
"AllowedValues": [
"cloud",
"cloud_efficiency",
"cloud_ssd",
"cloud_essd",
"ephemeral_ssd"
]
},
"InternetChargeType": {
"Type": "String",
"Description": "Instance internet access charge type.Support 'PayByBandwidth' and 'PayByTraffic' only.",
"AllowedValues": [
"PayByBandwidth",
"PayByTraffic"
]
},
"InstanceName": {
"Type": "String",
"Description": "Display name of the instance, [2, 128] English or Chinese characters, must start with a letter or Chinese in size, can contain numbers, '_' or '.', '-'"
},
"InternetMaxBandwidthOut": {
"Type": "Number",
"Description": "Max internet out bandwidth in Mbps(Mega bit per second). Range is [0,200].While the property is not 0, public ip will be assigned for instance.",
"MinValue": 0,
"MaxValue": 200
},
"InternetMaxBandwidthIn": {
"Type": "Number",
"Description": "Max internet in bandwidth in Mbps(Mega bit per second). The range is [1,200].",
"MinValue": 1,
"MaxValue": 200
},
"SecurityEnhancementStrategy": {
"Type": "String",
"Description": "Activate or deactivate security enhancement,Value range: \"Active\" and \"Deactive\"",
"AllowedValues": [
"Active",
"Deactive"
]
},
"AutoReleaseTime": {
"Type": "String",
"Description": "Auto release time for created instance, Follow ISO8601 standard using UTC time. format is 'yyyy-MM-ddTHH:mm:ssZ'. Not bigger than 3 years from this day onwards"
}
},
"Resources": {
"LaunchTemplate": {
"Type": "ALIYUN::ECS::LaunchTemplate",
"Properties": {
"Description": {
"Ref": "Description"
},
"DiskMappings": {
"Ref": "DiskMappings"
},
"SystemDiskSize": {
"Ref": "SystemDiskSize"
},
"UserData": {
"Ref": "UserData"
},
"SystemDiskDescription": {
"Ref": "SystemDiskDescription"
},
"TemplateTags": {
"Ref": "TemplateTags"
},
"RamRoleName": {
"Ref": "RamRoleName"
},
"NetworkType": {
"Ref": "NetworkType"
},
"NetworkInterfaces": {
"Ref": "NetworkInterfaces"
},
"ImageId": {
"Ref": "ImageId"
},
"SystemDiskDiskName": {
"Ref": "SystemDiskDiskName"
},
"SpotPriceLimit": {
"Ref": "SpotPriceLimit"
},
"InstanceType": {
"Ref": "InstanceType"
},
"Tags": {
"Ref": "Tags"
},
"HostName": {
"Ref": "HostName"
},
"SpotStrategy": {
"Ref": "SpotStrategy"
},
"KeyPairName": {
"Ref": "KeyPairName"
},
"LaunchTemplateName": {
"Ref": "LaunchTemplateName"
},
"IoOptimized": {
"Ref": "IoOptimized"
},
"VersionDescription": {
"Ref": "VersionDescription"
},
"ZoneId": {
"Ref": "ZoneId"
},
"VSwitchId": {
"Ref": "VSwitchId"
},
"SecurityGroupId": {
"Ref": "SecurityGroupId"
},
"SystemDiskCategory": {
"Ref": "SystemDiskCategory"
},
"InternetChargeType": {
"Ref": "InternetChargeType"
},
"InstanceName": {
"Ref": "InstanceName"
},
"InternetMaxBandwidthOut": {
"Ref": "InternetMaxBandwidthOut"
},
"InternetMaxBandwidthIn": {
"Ref": "InternetMaxBandwidthIn"
},
"SecurityEnhancementStrategy": {
"Ref": "SecurityEnhancementStrategy"
},
"AutoReleaseTime": {
"Ref": "AutoReleaseTime"
}
}
}
},
"Outputs": {
"LaunchTemplateName": {
"Description": "The name of launch template.",
"Value": {
"Fn::GetAtt": [
"LaunchTemplate",
"LaunchTemplateName"
]
}
},
"LatestVersionNumber": {
"Description": "The latest version number of launch template.",
"Value": {
"Fn::GetAtt": [
"LaunchTemplate",
"LatestVersionNumber"
]
}
},
"LaunchTemplateId": {
"Description": "The id of launch template.",
"Value": {
"Fn::GetAtt": [
"LaunchTemplate",
"LaunchTemplateId"
]
}
},
"DefaultVersionNumber": {
"Description": "The default version number of launch template.",
"Value": {
"Fn::GetAtt": [
"LaunchTemplate",
"DefaultVersionNumber"
]
}
}
}
}
YAML
格式
ROSTemplateFormatVersion: '2015-09-01'
Parameters:
Description:
Type: String
Description: 'Description of the instance, [2, 256] characters.'
DiskMappings:
Type: Json
Description: Disk mappings to attach to instance. Max support 16 disks.
MaxLength: 16
SystemDiskSize:
Type: Number
Description: >-
Disk size of the system disk, range from 20 to 500 GB. If you specify with
your own image, make sure the system disk size bigger than image size.
MinValue: 20
UserData:
Type: String
Description: 'User data to pass to instance. [1, 16KB] characters.'
SystemDiskDescription:
Type: String
Description: Description of created system disk.
TemplateTags:
Type: Json
Description: Template tags to attach to launch template.
MaxLength: 20
RamRoleName:
Type: String
Description: >-
Instance RAM role name. The name is provided and maintained by Resource
Access Management (RAM) and can be queried using ListRoles. For more
information, see RAM API CreateRole and ListRoles.
NetworkType:
Type: String
Description: Instance network type. Support 'vpc' and 'classic'
AllowedValues:
- vpc
- classic
NetworkInterfaces:
Type: Json
Description: Elastic network interfaces to be attached to instance.
MaxLength: 8
ImageId:
Type: String
Description: Image ID to create ecs instance.
SystemDiskDiskName:
Type: String
Description: Name of created system disk.
SpotPriceLimit:
Type: String
Description: >-
The hourly price threshold of a instance, and it takes effect only when
parameter InstanceChargeType is PostPaid. Three decimals is allowed at
most.
InstanceType:
Type: String
Description: 'Ecs instance supported instance type, make sure it should be correct.'
Tags:
Type: Json
Description: 'Tags to attach to instance, security group, disk and network interface.'
MaxLength: 20
HostName:
Type: String
Description: >-
Host name of created ecs instance. at least 2 characters, and '.' '-' Is
not the first and last characters as hostname, not continuous use. Windows
platform can be up to 15 characters, allowing letters (without limiting
case), numbers and '-', and does not support the number of points, not all
is digital ('.').Other (Linux, etc.) platform up to 30 characters,
allowing support number multiple points for the period between the points,
each permit letters (without limiting case), numbers and '-' components.
SpotStrategy:
Type: String
Description: >-
The spot strategy of a Pay-As-You-Go instance, and it takes effect only
when parameter InstanceChargeType is PostPaid. Value range: "NoSpot: A
regular Pay-As-You-Go instance", "SpotWithPriceLimit: A price threshold
for a spot instance, ""SpotAsPriceGo: A price that is based on the highest
Pay-As-You-Go instance. "
AllowedValues:
- NoSpot
- SpotWithPriceLimit
- SpotAsPriceGo
KeyPairName:
Type: String
Description: SSH key pair name.
LaunchTemplateName:
Type: String
Description: The name of launch template.
IoOptimized:
Type: String
Description: >-
The 'optimized' instance can provide better IO performance. Support 'none'
and 'optimized' only.
AllowedValues:
- none
- optimized
VersionDescription:
Type: String
Description: Description for version 1 of launch template.
ZoneId:
Type: String
Description: Current zone to create the instance.
VSwitchId:
Type: String
Description: The vSwitch Id to create ecs instance.
SecurityGroupId:
Type: String
Description: >-
Security group to create ecs instance. For classic instance need the
security group not belong to VPC, for VPC instance, please make sure the
security group belong to specified VPC.
SystemDiskCategory:
Type: String
Description: >-
Category of system disk. support
cloud|cloud_efficiency|cloud_ssd|cloud_essd|ephemeral_ssd
AllowedValues:
- cloud
- cloud_efficiency
- cloud_ssd
- cloud_essd
- ephemeral_ssd
InternetChargeType:
Type: String
Description: >-
Instance internet access charge type.Support 'PayByBandwidth' and
'PayByTraffic' only.
AllowedValues:
- PayByBandwidth
- PayByTraffic
InstanceName:
Type: String
Description: >-
Display name of the instance, [2, 128] English or Chinese characters, must
start with a letter or Chinese in size, can contain numbers, '_' or '.',
'-'
InternetMaxBandwidthOut:
Type: Number
Description: >-
Max internet out bandwidth in Mbps(Mega bit per second). Range is
[0,200].While the property is not 0, public ip will be assigned for
instance.
MinValue: 0
MaxValue: 200
InternetMaxBandwidthIn:
Type: Number
Description: >-
Max internet in bandwidth in Mbps(Mega bit per second). The range is
[1,200].
MinValue: 1
MaxValue: 200
SecurityEnhancementStrategy:
Type: String
Description: >-
Activate or deactivate security enhancement,Value range: "Active" and
"Deactive"
AllowedValues:
- Active
- Deactive
AutoReleaseTime:
Type: String
Description: >-
Auto release time for created instance, Follow ISO8601 standard using UTC
time. format is 'yyyy-MM-ddTHH:mm:ssZ'. Not bigger than 3 years from this
day onwards
Resources:
LaunchTemplate:
Type: 'ALIYUN::ECS::LaunchTemplate'
Properties:
Description:
Ref: Description
DiskMappings:
Ref: DiskMappings
SystemDiskSize:
Ref: SystemDiskSize
UserData:
Ref: UserData
SystemDiskDescription:
Ref: SystemDiskDescription
TemplateTags:
Ref: TemplateTags
RamRoleName:
Ref: RamRoleName
NetworkType:
Ref: NetworkType
NetworkInterfaces:
Ref: NetworkInterfaces
ImageId:
Ref: ImageId
SystemDiskDiskName:
Ref: SystemDiskDiskName
SpotPriceLimit:
Ref: SpotPriceLimit
InstanceType:
Ref: InstanceType
Tags:
Ref: Tags
HostName:
Ref: HostName
SpotStrategy:
Ref: SpotStrategy
KeyPairName:
Ref: KeyPairName
LaunchTemplateName:
Ref: LaunchTemplateName
IoOptimized:
Ref: IoOptimized
VersionDescription:
Ref: VersionDescription
ZoneId:
Ref: ZoneId
VSwitchId:
Ref: VSwitchId
SecurityGroupId:
Ref: SecurityGroupId
SystemDiskCategory:
Ref: SystemDiskCategory
InternetChargeType:
Ref: InternetChargeType
InstanceName:
Ref: InstanceName
InternetMaxBandwidthOut:
Ref: InternetMaxBandwidthOut
InternetMaxBandwidthIn:
Ref: InternetMaxBandwidthIn
SecurityEnhancementStrategy:
Ref: SecurityEnhancementStrategy
AutoReleaseTime:
Ref: AutoReleaseTime
Outputs:
LaunchTemplateName:
Description: The name of launch template.
Value:
'Fn::GetAtt':
- LaunchTemplate
- LaunchTemplateName
LatestVersionNumber:
Description: The latest version number of launch template.
Value:
'Fn::GetAtt':
- LaunchTemplate
- LatestVersionNumber
LaunchTemplateId:
Description: The id of launch template.
Value:
'Fn::GetAtt':
- LaunchTemplate
- LaunchTemplateId
DefaultVersionNumber:
Description: The default version number of launch template.
Value:
'Fn::GetAtt':
- LaunchTemplate
- DefaultVersionNumber