Creates a version for a launch template.
Usage notes
If you want to modify the parameters of a launch template version, you can create another version with different parameter settings for the launch template. Up to 30 versions can be created for each launch template.
Debugging
Request parameters
Parameter |
Type |
Required |
Example |
Description |
Action | String | Yes | CreateLaunchTemplateVersion | The operation that you want to perform. Set the value to CreateLaunchTemplateVersion. |
RegionId | String | Yes | cn-hangzhou | The region ID of the launch template. You can call the DescribeRegions operation to query the most recent region list. |
LaunchTemplateId | String | No | lt-m5eiaupmvm2op9d**** | The ID of the launch template. For more information, call the DescribeLaunchTemplates operation. You must specify |
LaunchTemplateName | String | No | testLaunchTemplateName | 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 |
VersionDescription | String | No | testVersionDescription | The description of the launch template version. The description must be 2 to 256 characters in length, and cannot start with |
ImageId | String | No | win2008r2_64_ent_sp1_en-us_40G_alibase_20170915.vhd | The ID of the image that you want to use to create Elastic Compute Service (ECS) instances. You can call the DescribeImages operation to query available images. |
ImageOwnerAlias | String | No | system | 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. |
PasswordInherit | Boolean | No | false | Specifies whether to use the password preset in the image. Valid values:
Default value: false. Note If PasswordInherit is specified, you must leave Password empty and make sure that the selected image has a password preset. |
InstanceType | String | No | ecs.g5.large | The instance type. For more information, see Overview of instance families or call the DescribeInstanceTypes operation to query the most recent instance type list. |
SecurityGroupId | String | No | sg-bp15ed6xe1yxeycg**** | The ID of the security group to which to assign the instance. Instances in the same security group can access each other. Note You cannot specify both SecurityGroupId and SecurityGroupIds.N . |
VpcId | String | No | vpc-bp12433upq1y5scen**** | The ID of the virtual private cloud (VPC). |
VSwitchId | String | No | vsw-bp1s5fnvk4gn2tws0**** | The ID of the vSwitch to which you want to connect the instance. This parameter is required if you specify VpcId. |
InstanceName | String | No | testInstanceName | The name of the instance. The name must be 2 to 128 characters in length. The name must start with a letter and cannot start with |
Description | String | No | testDescription | The description of the instance. The description must be 2 to 256 characters in length, and cannot start with |
InternetMaxBandwidthIn | Integer | No | 50 | The maximum inbound public bandwidth. Unit: Mbit/s. Valid values:
|
InternetMaxBandwidthOut | Integer | No | 5 | The maximum outbound public bandwidth. Unit: Mbit/s. Valid values: 0 to 100. |
HostName | String | No | testHostName | The hostname of the instance.
|
ZoneId | String | No | cn-hangzhou-g | The ID of the zone in which you want to create the instance. |
SystemDisk.Category | String | No | cloud_ssd | The category of the system disk. Valid values:
For non-I/O optimized instances of a retired instance type, the default value is cloud. For instances of other types, the default value is cloud_efficiency. |
SystemDisk.Size | Integer | No | 40 | The size of the system disk. Unit: GiB. Valid values: 20 to 500. The value of this parameter must be at least 20 and greater than or equal to the image size. |
SystemDisk.DiskName | String | No | cloud_ssdSystem | 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 |
SystemDisk.Description | String | No | testSystemDiskDescription | The description of the system disk. The description must be 2 to 256 characters in length, and cannot start with |
SystemDisk.Iops | Integer | No | 30000 | Note This parameter is not publicly available. |
SystemDisk.PerformanceLevel | String | No | PL0 | The performance level of the ESSD to use as the system disk. Valid values:
For more information about ESSD performance levels, see ESSDs. |
SystemDisk.DeleteWithInstance | Boolean | No | true | Specifies whether to release the system disk if the instance is released. Valid values:
Default value: true. |
SystemDisk.AutoSnapshotPolicyId | String | No | sp-bp1dgzpaxwc4load**** | The ID of the automatic snapshot policy to apply to the system disk. |
SystemDisk.ProvisionedIops | Long | No | 50000 | 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 performance} Baseline performance = min{1,800 + 50 × Capacity, 50,000} Note This parameter is available only if the DataDisk.N.Category parameter is set to cloud_auto. For more information, see ESSD AutoPL disks and Modify the performance configurations of an ESSD AutoPL disk. |
SystemDisk.BurstingEnabled | Boolean | No | true | Specifies whether to enable the performance burst feature. Valid values:
|
IoOptimized | String | No | optimized | Specifies whether the instance is I/O optimized. Valid values:
|
InstanceChargeType | String | No | PrePaid | The billing method of the instance. Valid values:
|
Period | Integer | No | 1 | The subscription duration of the instance. Unit: month. This parameter is valid and required only when |
InternetChargeType | String | No | PayByTraffic | The billing method for network usage. 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, the maximum bandwidth values may be limited. If you want guaranteed bandwidths for your instances, use the pay-by-bandwidth billing method for network usage. |
EnableVmOsConfig | Boolean | No | false | Specifies whether to enable the operating system configuration of the instance. |
NetworkType | String | No | vpc | The network type of the instance. Valid values:
|
UserData | String | No | ZWNobyBoZWxsbyBl**** | The user data of the instance. The user data must be encoded in Base64. The maximum size of raw data is 16 KB. |
KeyPairName | String | No | testKeyPairName | The name of the key pair.
|
RamRoleName | String | No | testRamRoleName | 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. |
AutoReleaseTime | String | No | 2018-01-01T12:05:00Z | 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.
|
SpotStrategy | String | No | NoSpot | The preemption policy for the pay-as-you-go instance. This parameter takes effect only when
|
SpotPriceLimit | Float | No | 0.97 | The maximum hourly price of the preemptible instance. Up to three decimal places are allowed. |
SpotDuration | Integer | No | 1 | 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 an appropriate protection period based on your business requirements. Note If you set SpotStrategy to SpotWithPriceLimit or SpotAsPriceGo, this parameter takes effect. |
ResourceGroupId | String | No | rg-bp67acfmxazb4p**** | The resource group ID. |
SecurityEnhancementStrategy | String | No | Active | Specifies whether to enable security hardening for the operating system. Valid values:
|
PrivateIpAddress | String | No | 10.1.**.** | The private IP address to assign to the instance. To assign a private IP address to an instance that resides in a VPC, make sure that the IP address is an idle IP address within the CIDR block of the vSwitch specified by |
Ipv6AddressCount | Integer | No | 1 | The number of IPv6 addresses to be randomly generated for the primary elastic network interface (ENI). Valid values: 1 to 10. |
DeploymentSetId | String | No | ds-bp1brhwhoqinyjd6**** | The ID of the deployment set in which to deploy the instance. |
DataDisk.N.PerformanceLevel | String | No | PL1 | The performance level of the ESSD to use as data disk N. The value of N must be the same as that in
For more information about ESSD performance levels, see ESSDs. |
DataDisk.N.Description | String | No | testDataDiskDescription | The description of data disk N. The description must be 2 to 256 characters in length, and cannot start with |
DataDisk.N.SnapshotId | String | No | s-bp17441ohwka0yuh**** | The ID of the snapshot that you want to use to create data disk N. Valid values of N: 1 to 16. If Use snapshots that were created after July 15, 2013. Otherwise, an error is returned and your request is rejected. |
DataDisk.N.Size | Integer | No | 2000 | 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 |
DataDisk.N.Device | String | No | null | Note This parameter will be removed in the future. We recommend that you use other parameters to ensure future compatibility. |
DataDisk.N.DiskName | String | No | testDataDiskName | 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 |
DataDisk.N.Category | String | No | cloud_ssd | 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. |
DataDisk.N.DeleteWithInstance | Boolean | No | true | Specifies whether to release data disk N when the instance is released. Valid values:
Default value: true. |
DataDisk.N.Encrypted | String | No | false | Specifies whether to encrypt data disk N. |
DataDisk.N.ProvisionedIops | Long | No | 50000 | 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 performance} Baseline performance = min{1,800 + 50 × Capacity, 50,000} Note This parameter is available only if the DataDisk.N.Category parameter is set to cloud_auto. For more information, see ESSD AutoPL disks and Modify the performance configurations of an ESSD AutoPL disk. |
DataDisk.N.BurstingEnabled | Boolean | No | true | Specifies whether to enable the performance burst feature. Valid values:
|
DataDisk.N.AutoSnapshotPolicyId | String | No | sp-bp67acfmxazb4p**** | The ID of the automatic snapshot policy to apply to data disk N. |
NetworkInterface.N.VSwitchId | String | No | vsw-bp1s5fnvk4gn2tws0**** | The ID of the vSwitch to which you want 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 |
NetworkInterface.N.NetworkInterfaceName | String | No | testNetworkInterfaceName | The name of the secondary ENI. The value of N in |
NetworkInterface.N.Description | String | No | testNetworkInterfaceDescription | The description of the secondary ENI. The description must be 2 to 256 characters in length, and cannot start with |
NetworkInterface.N.SecurityGroupId | String | No | sg-bp15ed6xe1yxeycg**** | The ID of the security group to which you want 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 . |
NetworkInterface.N.PrimaryIpAddress | String | No | 192.168.**.** | The primary private IP address of the secondary ENI. The value of N in |
NetworkInterface.N.SecurityGroupIds.N | String | No | sg-bp67acfmxazb4p**** | The ID of security group N to which you want 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 . |
NetworkInterface.N.InstanceType | String | No | Secondary | The type of ENI N. Valid values of N: 1 and 2. If the value of N is 1, you can configure a primary ENI or a secondary ENI. If the value of N is 2, you can configure a primary ENI and a secondary ENI. Valid values:
Default value: Secondary. |
NetworkInterface.N.NetworkInterfaceTrafficMode | String | No | Standard | The communication mode of the primary ENI. Valid values:
|
Tag.N.Key | String | No | TestKey | The key of tag N to add to the instance, Elastic Block Storage (EBS) devices, or primary ENI. Valid values of N: 1 to 5. The tag key cannot be an empty string. The tag key can be up to 64 characters in length and cannot start with |
Tag.N.Value | String | No | TestValue | The value of tag N to add to the instance, EBS devices, or primary ENI. Valid values of N: 1 to 5. The tag value can be an empty string. The tag value can be up to 128 characters in length and cannot start with |
SecurityGroupIds.N | String | No | sg-bp15ed6xe1yxeycg7**** | The ID of security group N to which you want to assign the instance. The valid values of N vary based on the maximum number of security groups to which an instance can belong. For more information, see Limits. Note You cannot specify both SecurityGroupId and SecurityGroupIds.N . |
SystemDisk.Encrypted | String | No | false | Specifies whether to encrypt the system disk. Valid values:
Default value: false. Note When you create instances in Hong Kong Zone D or Singapore Zone A, you cannot encrypt the system disks. |
DeletionProtection | Boolean | No | false | Specifies whether to enable release protection for the instance. This parameter determines 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. It can protect instances against manual releases, but not against automatic releases. |
CreditSpecification | String | No | Standard | The performance mode of the burstable instance. Valid values:
|
Response parameters
Parameter |
Type |
Example |
Description |
LaunchTemplateVersionNumber | Long | 2 | The version number of the launch template. |
RequestId | String | 473469C7-AA6F-4DC5-B3DB-A3DC0DEX**** | The ID of the request. |
LaunchTemplateId | String | lt-bp1apo0bbbkuy0rj**** | The ID of the launch template. For more information, see DescribeLaunchTemplates. You must specify |
Examples
Sample requests
http(s)://ecs.aliyuncs.com/?Action=CreateLaunchTemplateVersion
&RegionId=cn-hangzhou
&LaunchTemplateId=lt-m5eiaupmvm2op9d****
&LaunchTemplateName=testLaunchTemplateName
&VersionDescription=testVersionDescription
&ImageId=win2008r2_64_ent_sp1_en-us_40G_alibase_20170915.vhd
&InstanceType=ecs.g5.large
&SecurityGroupId=sg-bp15ed6xe1yxeycg****
&VpcId=vpc-bp12433upq1y5scen****
&VSwitchId=vsw-bp1s5fnvk4gn2tws0****
&InstanceName=testInstanceName
&Description=testDescription
&InternetMaxBandwidthIn=50
&InternetMaxBandwidthOut=5
&HostName=testHostName
&ZoneId=cn-hangzhou-g
&SystemDisk.Category=cloud_ssd
&SystemDisk.Size=40
&SystemDisk.DiskName=testSystemDiskName
&SystemDisk.Description=testSystemDiskDescription
&DataDisk.1.Size=2000
&DataDisk.1.SnapshotId=s-bp17441ohwka0yuh****
&DataDisk.1.Category=cloud_ssd
&DataDisk.1.Encrypted=false
&DataDisk.1.DiskName=cloud_ssdData
&DataDisk.1.Description=testDataDiskDescription
&DataDisk.1.DeleteWithInstance=true
&IoOptimized=optimized
&NetworkInterface.1.PrimaryIpAddress=192.168.**.**
&NetworkInterface.1.VSwitchId=vsw-bp1s5fnvk4gn2tws0****
&NetworkInterface.1.SecurityGroupId=sg-bp15ed6xe1yxeycg****
&NetworkInterface.1.NetworkInterfaceName=testNetworkInterfaceName
&NetworkInterface.1.Description=testNetworkInterfaceDescription
&PrivateIpAddress=10.1.**.**
&InstanceChargeType=PrePaid
&Period=1
&InternetChargeType=PayByTraffic
&NetworkType=vpc
&UserData=ZWNobyBoZWxsbyBl****
&RamRoleName=testRamRoleName
&AutoReleaseTime=2020-02-02T12:05:00Z
&SpotStrategy=NoSpot
&SpotPriceLimit=0.97
&SecurityEnhancementStrategy=Active
&Tag.1.Key=TestKey
&Tag.1.Value=TestValue
&<Common request parameters>
Sample success responses
XML
format
HTTP/1.1 200 OK
Content-Type:application/xml
<CreateLaunchTemplateVersionResponse>
<LaunchTemplateVersionNumber>2</LaunchTemplateVersionNumber>
<RequestId>473469C7-AA6F-4DC5-B3DB-A3DC0DEX****</RequestId>
<LaunchTemplateId>lt-bp1apo0bbbkuy0rj****</LaunchTemplateId>
</CreateLaunchTemplateVersionResponse>
JSON
format
HTTP/1.1 200 OK
Content-Type:application/json
{
"LaunchTemplateVersionNumber" : 2,
"RequestId" : "473469C7-AA6F-4DC5-B3DB-A3DC0DEX****",
"LaunchTemplateId" : "lt-bp1apo0bbbkuy0rj****"
}
Error codes
HTTP status code |
Error code |
Error message |
Description |
400 | InvalidRegion.NotExist | %s | The specified region is not found. |
400 | MissingParameter | %s | A required parameter is not specified. |
400 | InvalidParameter | %s | Invalid parameter value. |
400 | InvalidDescription.Malformed | The specified parameter "Description" is not valid. | Invalid Description format. The description must be 2 to 256 characters in length and cannot start with http:// or https://. |
400 | InvalidUserData.SizeExceeded | %s | The maximum size of the specified user data is exceeded. |
400 | InvalidUserData.Base64FormatInvalid | %s | Invalid UserData format. |
400 | Duplicate.TagKey | The Tag.N.Key contain duplicate key. | The tag key already exists. Tag keys must be unique. |
403 | LaunchTemplateVersionLimitExceed | %s | The maximum number of launch template versions is exceeded. |
404 | InvalidLaunchTemplate.NotFound | %s | The specified launch template is not found. Check whether the parameter value is correct. |
404 | InvalidResourceGroup.NotFound | The ResourceGroup provided does not exist in our records. | The resource group is not found. |
500 | InternalError | The request processing has failed due to some unknown error. | An internal error occurred. Try again later. |
For a list of error codes, see Service error codes.