You can call this operation to create a version for the specified instance launch template.

Description

You can create at most 30 versions for each instance launch template. The CreateLaunchTemplateVersion operation allows you to create new versions of launch templates instead of modifying existing template versions. To modify the parameters of a specific version, you can create a new template version. For more information, see CreateLaunchTemplate.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
RegionId String Yes cn-hangzhou

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

Action String No CreateLaunchTemplateVersion

The operation that you want to perform. Set the value to CreateLaunchTemplateVersion.

AutoReleaseTime String No 2018-01-01T12:05:00Z

The time when the instance is automatically released. Specify the time in the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time must be in UTC.

  • If the value of the seconds field (ss) is not 00, the time will automatically be set to the start of the current minute (mm).
  • It must be at least 30 minutes later than the current time.
  • It must be no later than three years from the current time.
DataDisk.N.Category String No cloud_ssd

The category of the Nth data disk. Valid values:

  • cloud: basic disk
  • cloud_efficiency: ultra disk
  • cloud_ssd: standard SSD
  • cloud_essd: enhanced SSD
DataDisk.N.DeleteWithInstance Boolean No true

Specifies whether the data disk is released together with the instance.

DataDisk.N.Description String No FinanceDept

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

DataDisk.N.DiskName String No cloud_ssdData

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

DataDisk.N.Encrypted String No false

Specifies whether the Nth data disk is encrypted.

DataDisk.N.Size Integer No 2000

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

  • cloud: 5 to 2000
  • cloud_efficiency: 20 to 32768
  • cloud_ssd: 20 to 32768
  • cloud_essd: 20 to 32768

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

DataDisk.N.SnapshotId String No s-bp17441ohwka0yuhx***

The ID of the snapshot used to create the Nth data disk. Valid values of N: 1 to 16. If the DataDisk.N.SnapshotId parameter is specified, the DataDisk.N.Size parameter will be ignored, and the size of the created disk will be the size of the specified snapshot.

The specified snapshot cannot be created on or before July 15, 2013. Otherwise, an error will be returned.

Description String No FinaceDept

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

EnableVmOsConfig Boolean No false

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

HostName String No JoshuaHost

The hostname of the instance.

  • It cannot start or end with a period (.) or a hyphen (-). It cannot contain consecutive periods (.) or hyphens (-).
  • For Windows, the hostname must be 2 to 15 characters in length. The hostname cannot contain periods (.) or only contain digits. It can contain letters, digits, and hyphens (-).
  • For other operating systems such as Linux, the hostname must be 2 to 64 characters in length. It can be segments separated with periods (.). Each segment can contain letters, digits, and hyphens (-).
ImageId String No win2008r2_64_ent_sp1_en-us_40G_alibase_20170915.vhd

The ID of the image resource that you specify when you launch the instance. You can call the DescribeImages operation to query the 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 compatibility.
InstanceChargeType String No PrePaid

The billing methods of the instances. Valid values:

  • PrePaid: subscription. If it is set to PrePaid, you must ensure that your payment account has sufficient credit. Otherwise, the InvalidPayMethod error message is returned.
  • PostPaid: pay-as-you-go.
InstanceName String No JoshuaHost

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

InstanceType String No ecs.g5.large

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

InternetChargeType String No PayByTraffic

The billing method for network usage. Valid values:

  • PayByBandwidth: pay-by-bandwidth.
  • PayByTraffic: pay-by-traffic.
InternetMaxBandwidthIn Integer No 200

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

InternetMaxBandwidthOut Integer No 5

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

IoOptimized String No optimized

Specifies whether the instance is I/O optimized. Valid values:

  • none: The instance is not I/O optimized.
  • optimized: The instance is I/O optimized.
KeyPairName String No Instancetest

The name of the key pair.

  • For Windows ECS instances, this parameter is ignored. The Password parameter is still used even if the KeyPairName parameter is specified.
  • By default, the username and password authentication method is disabled for Linux ECS instances.
LaunchTemplateId String No lt-m5eiaupmvm2op9dxxxxx

The ID of the instance launch template. For more information, call the DescribeLaunchTemplates operation. You must set the value of LaunchTemplateId or LaunchTemplateName to specify the launch template.

LaunchTemplateName String No JoshuaWinPrePaid

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

NetworkInterface.N.Description String No FinnanceDept

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

Note The value of N in the NetworkInterface.N parameter cannot be greater than 1.
NetworkInterface.N.NetworkInterfaceName String No FinnanceJoshua

The name of the Nth ENI.

Note The value of N in the NetworkInterface.N parameter cannot be greater than 1.
NetworkInterface.N.PrimaryIpAddress String No 192.168.2.XXX

The primary private IP address of the Nth ENI.

Note The value of N in the NetworkInterface.N parameter cannot be greater than 1.
NetworkInterface.N.SecurityGroupId String No sg-bp15ed6xe1yxeycg7***

The ID of the security group to which the Nth ENI belongs. The security group of the Nth ENI must belong to the same VPC as that of the instance.

Note The value of N in the NetworkInterface.N parameter cannot be greater than 1.
NetworkInterface.N.VSwitchId String No vsw-bp1s5fnvk4gn2tws03***

The ID of the VSwitch to which the Nth ENI belongs. The instance and the Nth ENI must be in the same zone of the same VPC, but they can belong to different VSwitches.

Note The value of N in the NetworkInterface.N parameter cannot be greater than 1.
NetworkType String No vpc

The network type of the instance. Valid values:

  • classic
  • vpc
Period Integer No 1

The subscription duration. Unit: month. This parameter is only valid and required when the value of the InstanceChargeType parameter is PrePaid. If the DedicatedHostId parameter is specified, the value range of the Period parameter must be within the subscription period of the dedicated host. Valid values:

  • If PeriodUnit is set to Week,the valid values of the Period parameter are 1, 2, 3, and 4.
  • If PeriodUnit is set to Month,the valid values of the Period parameter are 1, 2, 3, 4, 5, 6, 7, 8, 9, 12, 24, 36, 48, and 60.
RamRoleName String No FinanceDept

The RAM role name of the instance. You can call the ListRoles operation provided by RAM to query the RAM roles that you have created.

ResourceGroupId String No rg-resourcegroupid

The ID of the resource group.

SecurityEnhancementStrategy String No Active

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

  • Active: enables security enhancement for public images.
  • Deactive: disables security enhancement for all image types.
SecurityGroupId String No sg-bp15ed6xe1yxeycg7***

The ID of the security group to which the instance belongs. Instances within the same security group can access one another.

SpotDuration Integer No 1

The protection period of the instance.

Note This parameter will be removed in the future. We recommend that you use other parameters to ensure compatibility.
SpotPriceLimit Float No 0.97

The maximum hourly price for a preemptible instance. This parameter supports up to three decimal places.

SpotStrategy String No NoSpot

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

  • NoSpot: the regular pay-as-you-go instance.
  • SpotWithPriceLimit: the preemptible instance with a user-defined maximum hourly price.
  • SpotAsPriceGo: the preemptible instance priced at the market price at the time of purchase.
SystemDisk.Category String No cloud_ssd

The category of the system disk. Valid values:

  • cloud: basic disk
  • cloud_efficiency: ultra disk
  • cloud_ssd: standard SSD
  • cloud_essd: enhanced SSD
SystemDisk.Description String No FinanceDept

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

SystemDisk.DiskName String No cloud_ssdSystem

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

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 GiB and greater than or equal to the size of the image.

Tag.N.Key String No FinanceDept

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

Tag.N.Value String No FinanceDept.Joshua

The value of the Nth tag of the instance, Block Storage, or primary NIC. Valid values of N: 1 to 5. It 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://.

UserData String No ZWNobyBoZWxsbyBlY***

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

VSwitchId String No vsw-bp1s5fnvk4gn2tws03***

The ID of the VSwitch. If you are creating an instance in a VPC, you must specify this parameter.

VersionDescription String No LTFinanceJoshua

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

VpcId String No vpc-bp12433upq1y5sceni***

The ID of the VPC.

ZoneId String No cn-hangzhou-g

The ID of the zone to which the instance belongs.

Response parameters

Parameter Type Example Description
LaunchTemplateVersionNumber Long 2

The version number of the instance launch template.

RequestId String 473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

The ID of the request.

Samples

Sample request

https://ecs.aliyuncs.com/?Action=CreateLaunchTemplateVersion
&RegionId=cn-hangzhou
&LaunchTemplateId=lt-m5eiaupmvm2op9d*****
&LaunchTemplateName=JoshuaWinPrePaid
&VersionDescription=LTFinanceJoshua
&ImageId=win2008r2_64_ent_sp1_en-us_40G_alibase_20170915.vhd
&InstanceType=ecs.g5.large
&SecurityGroupId=sg-bp15ed6xe1yxeycg7***
&VpcId=vpc-bp12433upq1y5sceni07X
&VSwitchId=vsw-bp1s5fnvk4gn2tws03***
&InstanceName=JoshuaHost
&Description=FinaceDept
&InternetMaxBandwidthIn=200
&InternetMaxBandwidthOut=5
&HostName=JoshuaHost
&ZoneId=cn-hangzhou-g
&SystemDisk.Category=cloud_ssd
&SystemDisk.Size=40
&SystemDisk.DiskName=cloud_ssdSystem
&SystemDisk.Description=FinanceDept
&DataDisk.1.Size=2000
&DataDisk.1.SnapshotId=s-bp17441ohwka0yuhx***
&DataDisk.1.Category=cloud_ssd
&DataDisk.1.Encrypted=false
&DataDisk.1.DiskName=cloud_ssdData
&DataDisk.1.Description=FinanceDept
&DataDisk.1.DeleteWithInstance=true
&IoOptimized=optimized
&NetworkInterface.1.PrimaryIpAddress=192.168.2.XXX
&NetworkInterface.1.VSwitchId=vsw-bp1s5fnvk4gn2tws03***
&NetworkInterface.1.SecurityGroupId=sg-bp15ed6xe1yxeycg7***
&NetworkInterface.1.NetworkInterfaceName=FinnanceJoshua
&NetworkInterface.1.Description=FinnanceDept
&InstanceChargeType=PrePaid
&Period=1
&InternetChargeType=PayByTraffic
&NetworkType=vpc
&UserData=ZWNobyBoZWxsbyBlY3Mh
&KeyPairName=Instancetest
&RamRoleName=FinanceDept
&AutoReleaseTime=2018-01-01T12:05:00Z
&SpotStrategy=NoSpot
&SpotPriceLimit=0.97
&SecurityEnhancementStrategy=Active
&Tag.1.Key=FinanceDept
&Tag.1.Value=FinanceDept.Joshua
&<Common request parameters>

Sample success response

XML format

<CreateLaunchTemplateVersionResponse>
      <RequestId>04F0F334-1335-436C-A1D7-6C044FExxxxx</RequestId>
      <LaunchTemplateVersionNumber>2</LaunchTemplateVersionNumber>
</CreateLaunchTemplateVersionResponse>

JSON format

{
	"RequestId":"04F0F334-1335-436C-A1D7-6C044FExxxxx",
	"LaunchTemplateVersionNumber":2
}

Error codes

HTTP status code Error code Error message Description
400 InvalidRegion.NotExist %s The error message returned because the specified region does not exist.
403 LaunchTemplateVersionLimitExceed %s The error message returned because the maximum number of the launch template versions has been reached.
404 InvalidLaunchTemplate.NotFound %s The error message returned because the specified launch template name does not exist.
400 MissingParameter %s The error message returned because a required parameter is not specified.
400 InvalidParameter %s The error message returned because the parameter format is invalid.
400 InvalidDescription.Malformed The specified parameter "Description" is not valid. The error message returned because the specified resource description is invalid. The description must be 2 to 256 characters in length and cannot start with http:// or https://.
403 InnerServiceFailed %s The error message returned because an internal service failed to be called.
400 InvalidUserData.SizeExceeded %s The error message returned because the size of the custom data specified by the UserData parameter exceeds the limit.
400 InvalidUserData.Base64FormatInvalid %s The error message returned because the format of the specified template version description is invalid.

For a list of error codes, visit the API Error Center.