Creates a version for a launch template. You can use the created version to create Elastic Compute Service (ECS) instances, scaling groups, or auto provisioning groups. When you call this operation, you can specify parameters, such as LaunchTemplateId, VersionDescription, and Tag, in the request.
Operation description
Debugging
Authorization information
The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action
policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:
- Operation: the value that you can use in the Action element to specify the operation on a resource.
- Access level: the access level of each operation. The levels are read, write, and list.
- Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
- The required resource types are displayed in bold characters.
- If the permissions cannot be granted at the resource level,
All Resources
is used in the Resource type column of the operation.
- Condition Key: the condition key that is defined by the cloud service.
- Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
Operation | Access level | Resource type | Condition key | Associated operation |
---|---|---|---|---|
ecs:CreateLaunchTemplateVersion | create |
|
| none |
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
RegionId | string | Yes | The region ID of the command. You can call the DescribeRegions operation to query the most recent list of regions. | cn-hangzhou |
LaunchTemplateId | string | No | The ID of the launch template. For more information, call the DescribeLaunchTemplates operation. You must specify | lt-m5eiaupmvm2op9d**** |
LaunchTemplateName | string | No | The name of the launch template. The name must be 2 to 128 characters in length. The name must start with a letter and cannot start with | testLaunchTemplateName |
VersionDescription | string | No | The description of the launch template version. The description must be 2 to 256 characters in length and cannot start with | testVersionDescription |
ImageId | string | No | The ID of the image to use to create the Elastic Compute Service (ECS) instance. You can call the DescribeImages operation to query available images. | win2008r2_64_ent_sp1_en-us_40G_alibase_20170915.vhd |
ImageOwnerAlias | string | No | The source of the image. Note
This parameter will be removed in the future. We recommend that you use other parameters to ensure future compatibility.
| system |
PasswordInherit | boolean | No | Specifies whether to use the password that is preconfigured in the image. Valid values:
Default value: false. Note
If you specify PasswordInherit, you must leave Password empty and make sure that a password is preconfigured for the image.
| false |
InstanceType | string | No | The instance type. For more information, see Overview of instance families. You can also call the DescribeInstanceTypes operation to query the most recent list of instance types. | ecs.g5.large |
SecurityGroupId | string | No | The ID of the security group to which to assign the ECS instance created based on the launch template version. Instances in the same security group can access each other. Note
You cannot specify SecurityGroupId and SecurityGroupIds.N in the same request.
| sg-bp15ed6xe1yxeycg**** |
VpcId | string | No | The ID of the virtual private cloud (VPC) in which to create the ECS instance. | vpc-bp12433upq1y5scen**** |
VSwitchId | string | No | The ID of the vSwitch to which to connect the instance. This parameter is required if you specify the VpcId parameter. | vsw-bp1s5fnvk4gn2tws0**** |
InstanceName | string | No | The instance name. The name must be 2 to 128 characters in length and can contain letters, digits, colons (:), underscores (_), periods (.), and hyphens (-). The default value of this parameter is the When you create multiple ECS instances at a time, you can batch configure sequential names for the instances. The instance names can contain square brackets ([]) and commas (,). For more information, see Batch configure sequential names or hostnames for multiple instances. | k8s-node-[1,4]-alibabacloud |
Description | string | No | The description of the instance. The description must be 2 to 256 characters in length and cannot start with | testDescription |
InternetMaxBandwidthIn | integer | No | The maximum inbound public bandwidth. Unit: Mbit/s. Valid values:
| 50 |
InternetMaxBandwidthOut | integer | No | The maximum outbound public bandwidth. Unit: Mbit/s. Valid values: 0 to 100. | 5 |
HostName | string | No | The hostname of the instance.
| testHostName |
ZoneId | string | No | The ID of the zone to which the instance belongs. | cn-hangzhou-g |
SystemDisk.Category | string | No | The category of the system disk. Valid values:
For non-I/O optimized instances of retired instance types, the default value is cloud. For other types of instances, the default value is cloud_efficiency. | cloud_ssd |
SystemDisk.Size | integer | No | The size of the system disk. Unit: GiB. Valid values:
The value of this parameter must be at least 20 and greater than or equal to the size of the image. | 40 |
SystemDisk.DiskName | string | No | The name of the system disk. The name must be 2 to 128 characters in length. The name must start with a letter and cannot start with | cloud_ssdSystem |
SystemDisk.Description | string | No | The description of the system disk. The description must be 2 to 256 characters in length and cannot start with | testSystemDiskDescription |
SystemDisk.Iops | integer | No | Note
This parameter is not publicly available.
| 30000 |
SystemDisk.PerformanceLevel | string | No | The performance level of the ESSD to be used as the system disk. Default value: PL0. Valid values:
For more information about ESSD performance levels, see ESSDs . | PL0 |
SystemDisk.DeleteWithInstance | boolean | No | Specifies whether to release the system disk when the instance is released. Valid values:
Default value: true. | true |
SystemDisk.AutoSnapshotPolicyId | string | No | The ID of the automatic snapshot policy to apply to the system disk. | sp-bp1dgzpaxwc4load**** |
SystemDisk.ProvisionedIops | long | No | The provisioned read/write IOPS of the ESSD AutoPL disk to use as data disk N. Valid values: 0 to min{50,000, 1,000 × Capacity - Baseline IOPS} Baseline IOPS = min{1,800 + 50 × Capacity, 50,000} Note
This parameter is available only if you set the Category parameter to cloud_auto. For more information, see ESSD AutoPL disks and Modify the performance configurations of an ESSD AutoPL disk.
| 50000 |
SystemDisk.BurstingEnabled | boolean | No | Specifies whether to enable the performance burst feature. Valid values:
| true |
IoOptimized | string | No | Specifies whether to create an I/O optimized instance. Valid values:
| optimized |
InstanceChargeType | string | No | The billing method of the instance. Valid values:
| PrePaid |
Period | integer | No | The subscription period of the instance. Unit: months. This parameter is valid and required only when | 1 |
InternetChargeType | string | No | The billing method for network usage. Default value: PayByTraffic. Valid values:
Note
When the pay-by-traffic billing method for network usage is used, the maximum inbound and outbound bandwidths are used as the upper limits of bandwidths instead of guaranteed performance specifications. In scenarios where demand outstrips resource supplies, these maximum bandwidth values may not be reached. If you want guaranteed bandwidths for your instance, use the pay-by-bandwidth billing method for network usage.
| PayByTraffic |
EnableVmOsConfig | boolean | No | Specifies whether to enable the operating system configuration of the instance. | false |
NetworkType | string | No | The network type of the instance. Valid values:
| vpc |
UserData | string | No | The user data of the instance. The user data must be encoded in Base64. The maximum size of raw data is 32 KB. | ZWNobyBoZWxsbyBl**** |
KeyPairName | string | No | The name of the key pair to bind to the instance.
| testKeyPairName |
RamRoleName | string | No | The name of the instance Resource Access Management (RAM) role. You can call the ListRoles operation provided by RAM to query the instance RAM roles that you created. | testRamRoleName |
AutoReleaseTime | string | No | The automatic release time of the instance. Specify the time in the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time must be in UTC.
| 2018-01-01T12:05:00Z |
SpotStrategy | string | No | The preemption policy for the pay-as-you-go instance. This parameter is valid only when the
| NoSpot |
SpotPriceLimit | float | No | The maximum hourly price of the preemptible instance. A maximum of three decimal places are allowed. | 0.97 |
SpotDuration | integer | No | The protection period of the preemptible instance. Unit: hours. Default value: 1. Valid values:
Alibaba Cloud sends an ECS system event to notify you 5 minutes before the instance is released. Preemptible instances are billed by second. We recommend that you specify a protection period based on your business requirements. Note
This parameter takes effect only if SpotStrategy is set to SpotWithPriceLimit or SpotAsPriceGo.
| 1 |
ResourceGroupId | string | No | The ID of the resource group to which to assign the instance. | rg-bp67acfmxazb4p**** |
SecurityEnhancementStrategy | string | No | Specifies whether to enable security hardening for the operating system. Valid values:
| Active |
PrivateIpAddress | string | No | The private IP address to assign to the instance. To assign a private IP address to an instance of the VPC type, make sure that the IP address is an idle IP address within the CIDR block of the vSwitch specified by the | 10.1.**.** |
Ipv6AddressCount | integer | No | The number of IPv6 addresses to randomly generate for the primary elastic network interface (ENI). Valid values: 1 to 10. | 1 |
DeploymentSetId | string | No | The ID of the deployment set to which to deploy the instance. | ds-bp1brhwhoqinyjd6**** |
DataDisk | array<object> | No | The data disks. | |
object | No | Data disk N. | ||
PerformanceLevel | string | No | The performance level of the ESSD to use as data disk N. The value of N must be the same as that in
For information about ESSD performance levels, see ESSDs . | PL1 |
Description | string | No | The description of data disk N. The description must be 2 to 256 characters in length and cannot start with | testDataDiskDescription |
SnapshotId | string | No | The ID of the snapshot to use to create data disk N. Valid values of N: 1 to 16. When Use snapshots created after July 15, 2013. Otherwise, an error is returned and your request is rejected. | s-bp17441ohwka0yuh**** |
Size | integer | No | The size of data disk N. Valid values of N: 1 to 16. Unit: GiB. Valid values:
The value of this parameter must be greater than or equal to the size of the snapshot specified by | 2000 |
Device | string | No | The mount point of data disk N. The mount points are named based on the number of data disks:
Note
This parameter is applicable to scenarios in which a full image is used to create instances. A full image is an image that contains an operating system, application software, and business data. For these scenarios, you can set the parameter to the mount point of data disk N contained in the full image and modify DataDisk.N.Size and DataDisk.N.Category to change the category and size of data disk N created based on the image.
| null |
DiskName | string | No | The name of data disk N. The name must be 2 to 128 characters in length. The name must start with a letter and cannot start with | testDataDiskName |
Category | string | No | The category of data disk N. Valid values:
For I/O optimized instances, the default value is cloud_efficiency. For non-I/O optimized instances, the default value is cloud. | cloud_ssd |
DeleteWithInstance | boolean | No | Specifies whether to release data disk N when the instance is released. Valid values:
Default value: true. | true |
Encrypted | string | No | Specifies whether to encrypt data disk N. | false |
ProvisionedIops | long | No | The provisioned read/write IOPS of the ESSD AutoPL disk. Valid values: 0 to min{50,000, 1,000 × Capacity - Baseline IOPS}. Baseline IOPS = min{1,800 + 50 × Capacity, 50,000}. Note
This parameter is available only if you set DiskCategory to cloud_auto. For more information, see ESSD AutoPL disks and Modify the performance configurations of an ESSD AutoPL disk.
| 50000 |
BurstingEnabled | boolean | No | Specifies whether to enable the performance burst feature for data disk N. Valid values:
| true |
AutoSnapshotPolicyId | string | No | The ID of the automatic snapshot policy to apply to data disk N. | sp-bp67acfmxazb4p**** |
NetworkInterface | array<object> | No | The information of the elastic network interfaces (ENIs). | |
object | No | The information of the ENI. | ||
VSwitchId | string | No | The ID of the vSwitch to which to connect the secondary ENI. The instance and the secondary ENI must reside in the same zone of the same VPC, but they can be connected to different vSwitches. The value of N in | vsw-bp1s5fnvk4gn2tws0**** |
NetworkInterfaceName | string | No | The name of the secondary ENI. The value of N in | testNetworkInterfaceName |
Description | string | No | The description of the secondary ENI. The description must be 2 to 256 characters in length and cannot start with | testNetworkInterfaceDescription |
SecurityGroupId | string | No | The ID of the security group to which to assign the secondary ENI. The security groups of the secondary ENI and of the instance must belong to the same VPC. The value of N in Note
You cannot specify both NetworkInterface.N.SecurityGroupId and NetworkInterface.N.SecurityGroupIds.N .
| sg-bp15ed6xe1yxeycg**** |
PrimaryIpAddress | string | No | The primary private IP address of the secondary ENI. The value of N in | 192.168.**.** |
SecurityGroupIds | array | No | The IDs of the security groups to which to assign the secondary ENI. The security group and the secondary ENI must belong to the same VPC. The valid values of N in Note
You cannot specify both NetworkInterface.N.SecurityGroupId and NetworkInterface.N.SecurityGroupIds.N .
| |
string | No | The ID of security group N to which to assign the secondary ENI. The security group and the secondary ENI must belong to the same VPC. The valid values of N in Note
You cannot specify both NetworkInterface.N.SecurityGroupId and NetworkInterface.N.SecurityGroupIds.N .
| sg-bp67acfmxazb4p**** | |
InstanceType | string | No | The type of ENI N. Valid values of N: 1 and 2. If the value of N is 1, you can configure a primary or secondary ENI. If the value of N is 2, you must configure a primary ENI and a secondary ENI. Valid values:
Default value: Secondary. | ecs.g5.large |
NetworkInterfaceTrafficMode | string | No | The communication mode of the primary ENI. Valid values:
| Standard |
Tag | array<object> | No | The tags to add to the ECS instance, disks, and primary elastic network interface (ENI) created based on the launch template version. | |
object | No | Tag N to add to the ECS instance, disks, and primary ENI created based on the launch template version. | ||
Key | string | No | The key of tag N to add to the ECS instance, disks, and primary ENI created based on the launch template version. Valid values of N: 1 to 20. The tag key cannot be an empty string. The tag key can be up to 128 characters in length and cannot contain http:// or https://. The tag key cannot start with acs: or aliyun. | TestKey |
Value | string | No | The value of tag N to add to the ECS instance, disks, and primary ENI created based on the launch template version. Valid values of N: 1 to 20. The tag value can be an empty string. The tag value can be up to 128 characters in length and cannot contain http:// or https://. | TestValue |
SecurityGroupIds | array | No | The ID of security group N to which to assign the instance. The valid values of N depend on the maximum number of security groups to which the instance can belong. For more information, see Quantity limits. Note
The SecurityGroupId parameter and the SecurityGroupIds.N parameter are mutually exclusive.
| |
string | No | The ID of security group N to which to assign the instance. The valid values of N depend on the maximum number of security groups to which an instance can belong. For more information, see the "Security group limits" section in Limits . Note
The SecurityGroupId parameter and the SecurityGroupIds.N parameter are mutually exclusive.
| sg-bp15ed6xe1yxeycg7**** | |
SystemDisk.Encrypted | string | No | Specifies whether to encrypt the system disk. Valid values:
Default value: false Note
You cannot encrypt system disks when you create instances in Hong Kong Zone D or Singapore Zone A.
| false |
DeletionProtection | boolean | No | Specifies whether to enable release protection for the instance. This parameter specifies whether you can use the ECS console or call the DeleteInstance operation to release the instance. Valid values:
Default value: false. Note
This parameter is applicable only to pay-as-you-go instances. The release protection feature can protect instances against manual releases, but not against automatic releases.
| false |
CreditSpecification | string | No | The performance mode of the burstable instance. Valid values:
| Standard |
AutoRenew | boolean | No | Specifies whether to enable auto-renewal for the instance. This parameter is valid only if
Default value: false. | true |
AutoRenewPeriod | integer | No | The auto-renewal period of the instance. Valid values: Valid values when PeriodUnit is set to Month: 1, 2, 3, 6, 12, 24, 36, 48, and 60. Default value: 1. | 1 |
PeriodUnit | string | No | The unit of the subscription period. Valid values: Month (default) | Month |
Response parameters
Examples
Sample success responses
JSON
format
{
"LaunchTemplateVersionNumber": 2,
"RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DExxxxx",
"LaunchTemplateId": "lt-bp1apo0bbbkuy0rj****\n"
}
Error codes
HTTP status code | Error code | Error message | Description |
---|---|---|---|
400 | InvalidRegion.NotExist | %s | The specified region does not exist. |
400 | MissingParameter | %s | A parameter is not specified. |
400 | InvalidParameter | %s | The specified parameter is invalid. |
400 | InvalidDescription.Malformed | The specified parameter "Description" is not valid. | The source description can be 2 to 256 characters in length. It cannot start with http:// and https://. |
400 | InvalidUserData.SizeExceeded | %s | The size of your specified user data exceeds the maximum allowed value. |
400 | InvalidUserData.Base64FormatInvalid | %s | The specified user data is invalid. |
400 | InvalidHostName.Malformed | The specified parameter "HostName" is not valid. | - |
400 | InvalidParams.CreateEniParams | %s | - |
400 | Duplicate.TagKey | The Tag.N.Key contain duplicate key. | The specified tag key already exists. Tag keys must be unique. |
403 | LaunchTemplateVersionLimitExceed | %s | The maximum number of launch template versions has been reached. |
404 | InvalidLaunchTemplate.NotFound | %s | The specified launch template does not exist. Check whether the parameter value is correct. |
404 | InvalidResourceGroup.NotFound | The ResourceGroup provided does not exist in our records. | The specified resource group does not exist. |
500 | InternalError | The request processing has failed due to some unknown error. | An internal error has occurred. Try again later. |
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation |
---|---|---|
2024-05-28 | The Error code has changed. The request parameters of the API has changed | View Change Details |
2023-10-18 | The Error code has changed. The request parameters of the API has changed | View Change Details |
2023-08-01 | The Error code has changed. The request parameters of the API has changed | View Change Details |
2023-03-10 | The Error code has changed. The response structure of the API has changed | View Change Details |
2022-07-11 | The Error code has changed. The request parameters of the API has changed | View Change Details |
2021-12-20 | The Error code has changed. The request parameters of the API has changed | View Change Details |