All Products
Search
Document Center

Elastic Compute Service:CreateLaunchTemplateVersion

Last Updated:Mar 26, 2024

Creates a version for a launch template.

Operation description

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. A maximum of 30 versions can be created for each launch template.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

There is currently no authorization information disclosed in the API.

Request parameters

ParameterTypeRequiredDescriptionExample
RegionIdstringYes

The region ID of the command. You can call the DescribeRegions operation to query the most recent list of regions.

cn-hangzhou
LaunchTemplateIdstringNo

The ID of the launch template. For more information, see DescribeLaunchTemplates . You must specify LaunchTemplateId or LaunchTemplateName to specify a launch template.

lt-m5eiaupmvm2op9d****
LaunchTemplateNamestringNo

The name of the launch template. The name must be 2 to 128 characters in length, It must start with a letter and cannot start with http:// or https://. It can contain letters, digits, colons (:), underscores (_), and hyphens (-).

testLaunchTemplateName
VersionDescriptionstringNo

The description of the launch template version. The description must be 2 to 256 characters in length and cannot start with http:// or https://.

testVersionDescription
ImageIdstringNo

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
ImageOwnerAliasstringNo

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
PasswordInheritbooleanNo

Specifies whether to use the password that is preconfigured in the image. Valid values:

  • true: uses the password that is preconfigured in the mage.
  • false: does not use the password that is preconfigured in the image.

Default value: false.

Note If the PasswordInherit parameter is specified, you must leave the Password parameter empty. Before you use this parameter, make sure that a password is preset for the image.
false
InstanceTypestringNo

The instance type. For more information, see Instance families or call the DescribeInstanceTypes operation to query the most recent instance type list.

ecs.g5.large
SecurityGroupIdstringNo

The ID of the security group to which to assign the instance. Instances within the same security group can access each other.

Note The SecurityGroupId parameter and the SecurityGroupIds.N parameter are mutually exclusive.
sg-bp15ed6xe1yxeycg****
VpcIdstringNo

The ID of the virtual private cloud (VPC).

vpc-bp12433upq1y5scen****
VSwitchIdstringNo

The ID of the vSwitch to which to connect the instance. This parameter is required if you specify the VpcId parameter.

vsw-bp1s5fnvk4gn2tws0****
InstanceNamestringNo

The instance name. The name must be 2 to 128 characters in length, It must start with a letter and cannot start with http:// or https://. It can contain letters, digits, colons (:), underscores (_), and hyphens (-).

testInstanceName
DescriptionstringNo

The description of the instance. The description must be 2 to 256 characters in length and cannot start with http:// or https://.

testDescription
InternetMaxBandwidthInintegerNo

The maximum inbound public bandwidth. Unit: Mbit/s. Valid values:

  • When the purchased outbound public bandwidth is less than or equal to 10 Mbit/s, the valid values of this parameter are 1 to 10 and the default value is 10.
  • If the purchased outbound public bandwidth is greater than 10 Mbit/s, the valid values of this parameter range from 1 to the InternetMaxBandwidthOut value and the default value is the InternetMaxBandwidthOut value.
50
InternetMaxBandwidthOutintegerNo

The maximum outbound public bandwidth. Unit: Mbit/s. Valid values: 0 to 100.

5
HostNamestringNo

The hostname of the instance.

  • The hostname cannot start or end with a period (.) or hyphen (-). It cannot contain consecutive periods (.) or hyphens (-).
  • For Windows instances, the hostname must be 2 to 15 characters in length and cannot contain periods (.) or contain only digits. It can contain letters, digits, and hyphens (-).
  • For instances that run other operating systems such as Linux, the hostname must be 2 to 64 characters in length. You can use periods (.) to separate the hostname into multiple segments. Each segment can contain letters, digits, and hyphens (-).
testHostName
ZoneIdstringNo

The ID of the zone to which the instance belongs.

cn-hangzhou-g
SystemDisk.CategorystringNo

The category of the system disk. Valid values:

  • cloud: basic disk
  • cloud_efficiency: ultra disk
  • cloud_ssd: standard SSD
  • cloud_auto: ESSD AutoPL disk
  • cloud_essd: enhanced SSD (ESSD). You can use the SystemDisk.PerformanceLevel parameter to set the performance level of the ESSD to use as the system disk.

For non-I/O optimized instances of a retired instance type, the default value is cloud. For other types of instances, the default value is cloud_efficiency.

cloud_ssd
SystemDisk.SizeintegerNo

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 size of the specified image.

40
SystemDisk.DiskNamestringNo

The name of the system disk. The name must be 2 to 128 characters in length, It must start with a letter and cannot start with http:// or https://. It can contain letters, digits, colons (:), underscores (_), and hyphens (-).

cloud_ssdSystem
SystemDisk.DescriptionstringNo

The description of the system disk. The description must be 2 to 256 characters in length and cannot start with http:// or https://.

testSystemDiskDescription
SystemDisk.IopsintegerNo
Note This parameter is unavailable.
30000
SystemDisk.PerformanceLevelstringNo

The performance level of the ESSD to be used as the system disk. Default value: PL0. Valid values:

  • PL0: A single ESSD can deliver up to 10,000 random read/write IOPS.
  • PL1: A single ESSD can deliver up to 50,000 random read/write IOPS.
  • PL2: A single ESSD can deliver up to 100,000 random read/write IOPS.
  • PL3: A single ESSD can deliver up to 1,000,000 random read/write IOPS.

For more information about ESSD performance levels, see ESSDs .

PL0
SystemDisk.DeleteWithInstancebooleanNo

Specifies whether to release the system disk when the instance is released. Valid values:

  • true: releases data disk N when the instance is released.
  • false: does not release data disk N when the instance is released.

Default value: true.

true
SystemDisk.AutoSnapshotPolicyIdstringNo

The ID of the automatic snapshot policy to apply to the system disk.

sp-bp1dgzpaxwc4load****
SystemDisk.ProvisionedIopslongNo

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.BurstingEnabledbooleanNo

Specifies whether to enable the performance burst feature. Valid values:

  • true: encrypts the disk.
  • false: does not enable the performance burst feature.
true
IoOptimizedstringNo

Specifies whether to create an I/O optimized instance. Valid values:

  • none: The instance is not I/O optimized.
  • optimized: creates an I/O optimized instance.
optimized
InstanceChargeTypestringNo

The billing method of the instance. Valid values:

  • PrePaid: subscription. If you set this parameter to PrePaid, make sure that your account has sufficient credits. Otherwise, an InvalidPayMethod error is returned.
  • PostPaid: pay-as-you-go
PrePaid
PeriodintegerNo

The subscription period of the instance. Unit: months. This parameter is valid and required only when InstanceChargeType is set to PrePaid. Valid values: 1, 2, 3, 4, 5, 6, 7, 8, 9, 12, 24, 36, 48, and 60.

1
InternetChargeTypestringNo

The billing method for network usage. Default value: PayByTraffic. Valid values:

  • PayByBandwidth: pay-by-bandwidth
  • PayByTraffic: pay-by-traffic
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
EnableVmOsConfigbooleanNo

Specifies whether to enable the operating system configuration of the instance.

false
NetworkTypestringNo

The network type of the instance. Valid values:

  • classic: classic network
  • vpc: VPC
vpc
UserDatastringNo

The user data of the instance. The user data must be encoded in Base64. The maximum size of raw data is 16 KB.

ZWNobyBoZWxsbyBl****
KeyPairNamestringNo

The name of the key pair to bind to the instance.

  • For Windows instances, this parameter is ignored The Password parameter is valid even if the KeyPairName parameter is specified.
  • For Linux instances, the password-based logon method is disabled by default.
testKeyPairName
RamRoleNamestringNo

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
AutoReleaseTimestringNo

The automatic release time of the instance. Specify the time in the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. in the yyyy-MM-ddTHH:mm:ssZ format. The time must be in UTC.

  • If the value of ss is not 00, the time is automatically rounded to the nearest minute based on the value of mm.
  • The specified time must be at least 30 minutes later than the current time.
  • The specified time can be at most three years from the current time.
2018-01-01T12:05:00Z
SpotStrategystringNo

The preemption policy for the pay-as-you-go instance. This parameter is valid only when the InstanceChargeType parameter is set to PostPaid. Default value: NoSpot. Valid values:

  • NoSpot: The instance is created as a pay-as-you-go instance.
  • SpotWithPriceLimit: The instances of the compute node are preemptible instances. These types of instances have a specified maximum hourly price.
  • SpotAsPriceGo: The instance is created as a preemptible instance for which the market price at the time of purchase is automatically used as the bid price.
NoSpot
SpotPriceLimitfloatNo

The maximum hourly price of the preemptible instance. A maximum of three decimal places are allowed.

0.97
SpotDurationintegerNo

The retention period of the preemptible instance. Unit: hours. Valid values: 0, 1, 2, 3, 4, 5, and 6

  • The following protection periods are available in invitational preview: 2, 3, 4, 5, and 6 hours. If you want to set this parameter to one of these values, submit a ticket.
  • A value of 0 indicates that no protection period is configured for the preemptible instance.

Default value: 1.

1
ResourceGroupIdstringNo

The ID of the resource group to which to assign the instance.

rg-bp67acfmxazb4p****
SecurityEnhancementStrategystringNo

Specifies whether to enable security hardening for the operating system. Valid values:

  • Active: Security hardening is enabled. This value is applicable only to public images.
  • Deactive: Security hardening is disabled. This value is available to all types of images.
Active
PrivateIpAddressstringNo

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 VSwitchId parameter.

10.1.**.**
Ipv6AddressCountintegerNo

The number of IPv6 addresses to randomly generate for the primary elastic network interface (ENI). Valid values: 1 to 10.

1
DeploymentSetIdstringNo

The ID of the deployment set to which to deploy the instance.

ds-bp1brhwhoqinyjd6****
DataDiskobject []No

The data disks.

PerformanceLevelstringNo

The performance level of the ESSD to use as data disk N. The value of N must be the same as that in DataDisk.N.Category when DataDisk.N.Category is set to cloud_essd. Default value: PL1. Valid values:

  • PL0: An ESSD can deliver up to 10,000 random read/write IOPS.
  • PL1: A single ESSD can deliver up to 50,000 random read/write IOPS.
  • PL2: A single ESSD can deliver up to 100,000 random read/write IOPS.
  • PL3: A single ESSD can deliver up to 1,000,000 random read/write IOPS.

For more information about ESSD performance levels, see ESSDs .

PL1
DescriptionstringNo

The description of data disk N. The description must be 2 to 256 characters in length and cannot start with http:// or https://.

testDataDiskDescription
SnapshotIdstringNo

The ID of the snapshot to use to create data disk N. Valid values of N: 1 to 16. If the DataDisk.N.SnapshotId parameter is specified, the DataDisk.N.Size parameter is ignored. The data disk is created with the size of the specified snapshot.

Use snapshots that were created on or after July 15, 2013. Otherwise, an error is returned and your request is rejected.

s-bp17441ohwka0yuh****
SizeintegerNo

The size of data disk N. Valid values of N: 1 to 16. Unit: GiB. Valid values:

  • Valid values if you set the Category parameter to cloud: 5 to 2000.

  • Valid values if you set the Category parameter to cloud_efficiency: 20 to 32768.

  • Valid values when DataDisk.N.Category is set to cloud_ssd: 20 to 32768.

  • Valid values when DataDisk.N.Category is set to cloud_essd: depend on the DataDisk.N.PerformanceLevel value.

    • Valid values when DataDisk.N.PerformanceLevel is set to PL0: 40 to 32768.
    • Valid values when DataDisk.N.PerformanceLevel is set to PL1: 20 to 32768.
    • Valid values when DataDisk.N.PerformanceLevel is set to PL2: 461 to 32768.
    • Valid values when DataDisk.N.PerformanceLevel is set to PL3: 1261 to 32768.

The value of this parameter must be greater than or equal to the size of the snapshot specified by the SnapshotId parameter.

2000
DevicestringNo
Note This parameter will be removed in the future. We recommend that you use other parameters to ensure future compatibility.
null
DiskNamestringNo

The name of data disk N. The name must be 2 to 128 characters in length, It must start with a letter and cannot start with http:// or https://. It can contain letters, digits, colons (:), underscores (_), and hyphens (-).

testDataDiskName
CategorystringNo

The category of data disk N. Valid values:

  • cloud: basic disk
  • cloud_efficiency: ultra disk
  • cloud_ssd: standard SSD
  • cloud_auto: ESSD AutoPL disk
  • cloud_essd: ESSD

For I/O optimized instances, the default value is cloud_efficiency. For non-I/O optimized instances, the default value is cloud.

cloud_ssd
DeleteWithInstancebooleanNo

Specifies whether to release data disk N when the instance is released. Valid values:

  • true: releases data disk N when the instance is released.
  • false: does not release data disk N when the instance is released.

Default value: true.

true
EncryptedstringNo

Specifies whether to encrypt data disk N.

false
ProvisionedIopslongNo

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
BurstingEnabledbooleanNo

Specifies whether to enable the performance burst feature. Valid values:

  • true: encrypts the disk.
  • false: does not enable the performance burst feature.
true
AutoSnapshotPolicyIdstringNo

The ID of the automatic snapshot policy to apply to data disk N.

sp-bp67acfmxazb4p****
NetworkInterfaceobject []No

The information of the ENI.

VSwitchIdstringNo

The ID of the vSwitch to which to connect the secondary ENI. The instance and the ENI must be located within the same zone of the same VPC, but they can be connected to different vSwitches. The value of N in NetworkInterface.N cannot be greater than 1.

vsw-bp1s5fnvk4gn2tws0****
NetworkInterfaceNamestringNo

The name of the secondary ENI. The value of N in NetworkInterface.N cannot be greater than 1.

testNetworkInterfaceName
DescriptionstringNo

The description of the secondary ENI. The description must be 2 to 256 characters in length and cannot start with http:// or https://. The value of N in NetworkInterface.N cannot be greater than 1.

testNetworkInterfaceDescription
SecurityGroupIdstringNo

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 NetworkInterface.N cannot be greater than 1.

Note The NetworkInterface.N.SecurityGroupId parameter and the NetworkInterface.N.SecurityGroupIds.N parameter are mutually exclusive.
sg-bp15ed6xe1yxeycg****
PrimaryIpAddressstringNo

The primary private IP address of the secondary ENI. The value of N in NetworkInterface.N cannot be greater than 1.

192.168.**.**
SecurityGroupIdsarrayNo

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 SecurityGroupIds.N depend on the maximum number of security groups to which the secondary ENI can belong. For more information, see the "Security group limits" section in Limits . The value of N in NetworkInterface.N cannot be greater than 1.

Note The NetworkInterface.N.SecurityGroupId parameter and the NetworkInterface.N.SecurityGroupIds.N parameter are mutually exclusive.
stringNo

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 SecurityGroupIds.N depend on the maximum number of security groups to which the secondary ENI can belong. For more information, see the "Security group limits" section in Limits . The value of N in NetworkInterface.N cannot be greater than 1.

Note The NetworkInterface.N.SecurityGroupId parameter and the NetworkInterface.N.SecurityGroupIds.N parameter are mutually exclusive.
sg-bp67acfmxazb4p****
InstanceTypestringNo

The instance type.

ecs.g5.large
NetworkInterfaceTrafficModestringNo

The communication mode of the primary ENI. Valid values:

  • Standard: uses the TCP communication mode.
  • HighPerformance: enables Elastic RDMA Interface (ERI) and uses the remote direct memory access (RDMA) communication mode.
Standard
Tagobject []No

The tags to add to the activation code.

KeystringNo

The key of tag N to add to the instance, block storage devices, or primary ENI. Valid values of N: 1 to 5. The tag key cannot be an empty string. It can be up to 64 characters in length and cannot start with acs: or aliyun. It cannot contain http:// or https://.

TestKey
ValuestringNo

The value of tag N to add to the instance, block storage devices, or primary ENI. Valid values of N: 1 to 5. The tag value can be an empty string. It can be up to 128 characters in length and cannot start with acs: or aliyun. It cannot contain http:// or https://.

TestValue
SecurityGroupIdsarrayNo

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.
stringNo

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.EncryptedstringNo

Specifies whether to encrypt the system disk. Valid values:

  • true
  • false

Default value: false

Note You cannot encrypt system disks when you create instances in Hong Kong Zone D or Singapore Zone A.
false
DeletionProtectionbooleanNo

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:

  • true
  • false

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.
false
CreditSpecificationstringNo

The performance mode of the burstable instance. Valid values:

  • Standard: the standard mode. For more information, see the "Standard mode" section in Burstable instances.
  • Unlimited: the unlimited mode. For more information, see the "Unlimited mode" section in Burstable instances.
Standard

Response parameters

ParameterTypeDescriptionExample
object
LaunchTemplateVersionNumberlong

The version number of the launch template.

2
RequestIdstring

The ID of the request.

473469C7-AA6F-4DC5-B3DB-A3DC0DExxxxx

Examples

Sample success responses

JSONformat

{
  "LaunchTemplateVersionNumber": 2,
  "RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DExxxxx",
  "LaunchTemplateId": "lt-bp1apo0bbbkuy0rj****\n"
}

Error codes

HTTP status codeError codeError messageDescription
400InvalidRegion.NotExist%sThe specified region does not exist.
400MissingParameter%sA parameter is not specified.
400InvalidParameter%sThe specified parameter is invalid.
400InvalidDescription.MalformedThe specified parameter "Description" is not valid.The source description can be 2 to 256 characters in length. It cannot start with http:// and https://.
400InvalidUserData.SizeExceeded%sThe size of your specified user data exceeds the maximum allowed value.
400InvalidUserData.Base64FormatInvalid%sThe specified user data is invalid.
400InvalidHostName.MalformedThe specified parameter "HostName" is not valid.-
400InvalidParams.CreateEniParams%s-
400Duplicate.TagKeyThe Tag.N.Key contain duplicate key.The specified tag key already exists. Tag keys must be unique.
403LaunchTemplateVersionLimitExceed%sThe maximum number of launch template versions has been reached.
404InvalidLaunchTemplate.NotFound%sThe specified launch template does not exist. Check whether the parameter value is correct.
404InvalidResourceGroup.NotFoundThe ResourceGroup provided does not exist in our records.The specified resource group does not exist.
500InternalErrorThe 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 timeSummary of changesOperation
2023-10-18The Error code has changed. The request parameters of the API has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    delete Error Codes: 400
    delete Error Codes: 403
    delete Error Codes: 404
    delete Error Codes: 500
Input ParametersThe request parameters of the API has changed.
    Added Input Parameters: CreditSpecification
2023-08-01The Error code has changed. The request parameters of the API has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    delete Error Codes: 400
    delete Error Codes: 403
    delete Error Codes: 404
    delete Error Codes: 500
Input ParametersThe request parameters of the API has changed.
    Added Input Parameters: DeletionProtection
2023-03-10The Error code has changed. The response structure of the API has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    delete Error Codes: 400
    delete Error Codes: 403
    delete Error Codes: 404
    delete Error Codes: 500
Output ParametersThe response structure of the API has changed.
2022-07-11The Error code has changed. The request parameters of the API has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    delete Error Codes: 400
    delete Error Codes: 403
    delete Error Codes: 404
    delete Error Codes: 500
Input ParametersThe request parameters of the API has changed.
    Added Input Parameters: SystemDisk.AutoSnapshotPolicyId
    Added Input Parameters: SystemDisk.ProvisionedIops
    Added Input Parameters: SystemDisk.BurstingEnabled
2021-12-20The Error code has changed. The request parameters of the API has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    delete Error Codes: 400
    delete Error Codes: 403
    delete Error Codes: 404
    delete Error Codes: 500
Input ParametersThe request parameters of the API has changed.
    Added Input Parameters: Ipv6AddressCount