All Products
Search
Document Center

:CreateLaunchTemplate

更新时间:Jan 17, 2024

Creates a launch template. A launch template eliminates the need to configure a large number of parameters every time you create an Elastic Compute Service (ECS) instance.

Usage notes

Launch templates contain preset configurations that are used to create instances, such as the region, image ID, instance type, security group ID, and public bandwidth settings. If a specific parameter that you want to use is not included in a launch template, specify the parameter when you use the launch template to create an instance.

After you create a launch template by calling the CreateLaunchTemplate operation, the version number of the launch template is set to 1 by default. You can create multiple versions by calling the CreateLaunchTemplateVersion operation for the launch template. Version numbers start from 1 and increment by one. If you do not specify a template version number when you use a launch template to create instances by calling the RunInstances operation, the default version is used.

Take note of the following items:

  • You can create up to 30 launch templates in each region. Each launch template can have up to 30 versions.
  • Most parameters in launch templates are optional. When you create a launch template, ECS does not verify the existence or validity of specified parameter values. The parameter values are verified only when you use the launch template to create instances.
  • If you configure a specific parameter in a launch template, you cannot filter out the parameter when you use the launch template to create instances by calling the RunInstances operation. For example, if you set HostName to LocalHost in a launch template but do not specify HostName when you call the RunInstances operation to create instances from the launch template, the instance hostname is still LocalHost. If you want to overwrite the LocalHost value of HostName provided by the launch template, you can set HostName to MyHost or another value when you call the RunInstances operation.

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

Action String Yes CreateLaunchTemplate

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

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.

TemplateTag.N.Key String No TestKey

The key of tag N that you want to add to the launch template. 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.

TemplateTag.N.Value String No TestValue

The value of tag N that you want to add to the launch template. 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://. The tag value cannot start with acs: or aliyun.

LaunchTemplateName String Yes testLaunchTemplateName

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

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 http:// or https://.

ImageId String No win2008r2_64_ent_sp1_en-us_40G_alibase_20170915.vhd

The ID of the image. You can call the DescribeImages operation to query available images.

ImageOwnerAlias String No system

The source of the image. Valid values:

  • system: public images provided by Alibaba Cloud.
  • self: custom images that you created.
  • others: shared images from other Alibaba Cloud accounts.
  • marketplace: images from Alibaba Cloud Marketplace. If Alibaba Cloud Marketplace images are available, you can use the images without the need to subscribe to the images. Take note of the billing details of Alibaba Cloud Marketplace images.
PasswordInherit Boolean No false

Specifies whether to use the password preset in the image.

Note If you use this parameter, leave Password empty and make sure that the selected image has a preset password.
InstanceType String No ecs.g5.large

The instance type of the instance. For more information, see Instance families. You can also 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 the instance belongs. Instances in the same security group can communicate with each other. Each security group can contain up to 1,000 instances.

Note You cannot specify 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 but cannot start with http:// or https://. The name can contain letters, digits, colons (:), underscores (_), and hyphens (-).

Description String No testECSDescription

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

InternetMaxBandwidthIn Integer No 10

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

  • If 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 are 1 to the InternetMaxBandwidthOut value and the default value is the InternetMaxBandwidthOut value.
InternetMaxBandwidthOut Integer No 10

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

HostName String No testHostName

The hostname of the instance.

  • The hostname cannot start or end with a period (.) or hyphen (-). The hostname 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. The hostname 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. Separate the hostname into multiple segments with periods (.). Each segment can contain letters, digits, and hyphens (-).
ZoneId String No cn-hangzhou-g

The zone ID of the instance.

SystemDisk.Category String No cloud_ssd

The category of the system disk. Valid values:

  • cloud: basic disk.
  • cloud_efficiency: ultra disk.
  • cloud_ssd: SSD.
  • cloud_essd: enhanced SSD (ESSD). You can use SystemDisk.PerformanceLevel 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.

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 testSystemDiskName

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

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 http:// or https://.

SystemDisk.Iops Integer No null
Note This parameter is in invitational preview and is not publicly available.
SystemDisk.PerformanceLevel String No PL0

The performance level of the ESSD to use as the system disk. Valid values:

  • PL0 (default): 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 million random read/write IOPS.

For more information about ESSD performance levels, see ESSDs.

SystemDisk.DeleteWithInstance Boolean No true

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

  • true
  • false

Default value: true.

SystemDisk.AutoSnapshotPolicyId String No sp-gc7c37d4ylw7mtnk****

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

SystemDisk.ProvisionedIops Long No 50000

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 SystemDisk.Category 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:

  • true
  • false
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.
InstanceChargeType String No PrePaid

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.
Period Integer No 1

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

InternetChargeType String No PayByTraffic

The billing method for network usage. Valid values:

  • PayByBandwidth
  • PayByTraffic
Note If the pay-by-traffic billing method is used for network usage, the maximum inbound and outbound bandwidths are used as upper limits of bandwidths instead of the guaranteed performance. In scenarios in which the demand outstrips resource supplies, the maximum bandwidth values may not be reached. 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 configurations of the instance.

Note This parameter will be removed in the future. To ensure future compatibility, we recommend that you use other parameters.
NetworkType String No vpc

The network type of the instance. Valid values:

  • classic: classic network.
  • vpc: VPC.
UserData String No ZWNobyBoZWxsbyBlY3Mh

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.

  • For Windows instances, this parameter is ignored. Password takes effect regardless of whether you specify KeyPairName.
  • For Linux instances, the password-based authentication method is disabled by default.
RamRoleName String No testRamRoleName

The name of the Resource Access Management (RAM) role of the instance. 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.

  • 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 up to three years from the current time.
SpotStrategy String No NoSpot

The preemption policy for the pay-as-you-go instance. This parameter takes effect only if you set InstanceChargeType to PostPaid. Valid values:

  • NoSpot: The instance is a pay-as-you-go instance.
  • SpotWithPriceLimit: The instance is a preemptible instance with a user-defined maximum hourly price.
  • SpotAsPriceGo: The instance is a preemptible instance for which the market price at the time of purchase is automatically used as the bidding price.
SpotPriceLimit Float No 0.97

The maximum hourly price of the instance. The value is accurate to three decimal places. This parameter takes effect only if you set SpotStrategy to SpotWithPriceLimit.

SpotDuration Integer No 1

The protection period of the preemptible instance. Unit: hours. Default value: 1. Valid values:

  • 1: After a preemptible instance is created, Alibaba Cloud ensures that the instance is not automatically released within 1 hour. After the 1-hour protection period ends, the system compares the bidding price with the market price and checks the resource inventory to determine whether to retain or release the instance.
  • 0: After a preemptible instance is created, Alibaba Cloud does not ensure that the instance runs for 1 hour. The system compares the biding price with the market price and checks the resource inventory to determine whether to retain or release the instance.

Alibaba Cloud sends ECS system events 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 If you set SpotStrategy to SpotWithPriceLimit or SpotAsPriceGo, this parameter takes effect.
ResourceGroupId String No rg-bp67acfmxazb4p****

The ID of the resource group to which the instance, Elastic Block Storage (EBS) device, and elastic network interface (ENI) belong.

TemplateResourceGroupId String No rg-bp67acfmxazb4p****

The ID of the resource group to which the launch template belongs.

SecurityEnhancementStrategy String No Deactive

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

  • Active: enables security hardening for the operating system.
  • Deactive: disables security hardening for the operating system.
PrivateIpAddress String No 10.1.**.**

The private IP address of 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 VSwitchId.

DeploymentSetId String No ds-bp1brhwhoqinyjd6****

The ID of the deployment set.

Ipv6AddressCount Integer No 1

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

DataDisk.N.PerformanceLevel String No PL1

The performance level of ESSD N used as the data disk. The value of N must be the same as that in DataDisk.N.Category if you set DataDisk.N.Category to cloud_essd. Valid values:

  • PL0: A single ESSD can deliver up to 10,000 random read/write IOPS.
  • PL1 (default): 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 million random read/write IOPS.

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 http:// or https://.

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 you specify DataDisk.N.SnapshotId, DataDisk.N.Size is ignored. The data disk is created based on the size of the specified snapshot.

Note Use snapshots 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:

  • Valid values if you set DataDisk.N.Category to cloud: 5 to 2000.
  • Valid values if you set DataDisk.N.Category to cloud_efficiency: 20 to 32768.
  • Valid values if you set DataDisk.N.Category to cloud_ssd: 20 to 32768.
  • Valid values if you set DataDisk.N.Category to cloud_essd: vary based on the value of DataDisk.N.PerformanceLevel.
    • Valid values if you set DataDisk.N.PerformanceLevel to PL0: 40 to 32768.
    • Valid values if you set DataDisk.N.PerformanceLevel to PL1: 20 to 32768.
    • Valid values if you set DataDisk.N.PerformanceLevel to PL2: 461 to 32768.
    • Valid values if you set DataDisk.N.PerformanceLevel to PL3: 1261 to 32768.

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

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 but cannot start with http:// or https://. The name can contain letters, digits, colons (:), underscores (_), and hyphens (-).

DataDisk.N.Category String No cloud_ssd

The category of data disk N. Valid values:

  • cloud: basic disk.
  • cloud_efficiency: ultra disk
  • cloud_ssd: SSD.
  • cloud_essd: enhanced SSD (ESSD).

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:

  • true
  • false

Default value: true.

DataDisk.N.Encrypted String No false

Specifies whether to encrypt data disk N.

DataDisk.N.AutoSnapshotPolicyId String No sp-m5e7fa9ute44ssa****

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

DataDisk.N.ProvisionedIops Long No 50000

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 SystemDisk.Category 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:

  • true
  • false
NetworkInterface.N.VSwitchId String No vsw-bp1s5fnvk4gn2tws0****

The ID of the vSwitch with which to associate ENI N.

Take note of the following items:

  • Valid values of N: 1 and 2. If the value of N is 1, you can specify a primary or secondary ENI. If the value of N is 2, you must specify a primary ENI and a secondary ENI.
  • If you set NetworkInterface.N.InstanceType to Primary, this parameter is required. In this case, this parameter is equivalent to VSwitchId. You cannot specify NetworkInterface.N.VSwitchId and VSwitchId.
  • If you set NetworkInterface.N.InstanceType to Secondary or leave the parameter empty, this parameter is optional. The default value is the ID of the vSwitch to which to connect the instance.
NetworkInterface.N.NetworkInterfaceName String No testEniName

The name of ENI N.

Take note of the following items:

  • Valid values of N: 1 and 2. If the value of N is 1, a primary or secondary ENI can be configured. If the value of N is 2, a primary ENI and a secondary ENI must be configured.
  • If you set NetworkInterface.N.InstanceType to Primary, you do not need to set this parameter.
NetworkInterface.N.Description String No testEniDescription

The description of secondary ENI N. 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.

NetworkInterface.N.SecurityGroupId String No sg-bp15ed6xe1yxeycg****

The ID of the security group to which ENI N belongs.

Take note of the following items:

  • Valid values of N: 1 and 2. If the value of N is 1, a primary or secondary ENI can be configured. If the value of N is 2, a primary ENI and a secondary ENI must be configured.
  • If NetworkInterface.N.InstanceType is set to Primary, this parameter is required. In this case, this parameter is equivalent to SecurityGroupId. You cannot specify SecurityGroupId, SecurityGroupIds.N, or NetworkInterface.N.SecurityGroupIds.N.
  • If you set NetworkInterface.N.InstanceType to Secondary or leave this parameter empty, NetworkInterface.SecurityGroupIds is optional. The default value is the ID of the security group to which the instance belongs.
NetworkInterface.N.PrimaryIpAddress String No 192.168.**.**

The primary IP address of ENI N.

Take note of the following items:

  • Valid values of N: 1 and 2.
    • If the value of N is 1, you can specify a primary or secondary ENI. If this parameter is specified, Amount is set to a numeric value greater than 1, and NetworkInterface.N.InstanceType is set to Primary, the specified number of instances are created and consecutive primary IP addresses starting from the specified one are assigned to the instances. In this case, you cannot bind secondary ENIs to these instances.
    • If the value of N is 2, a primary ENI and a secondary ENI must be configured. If this parameter is specified, Amount is set to a numeric value greater than 1, and NetworkInterface.N.InstanceType is set to Primary, you cannot set NetworkInterface.2.InstanceType to Secondary to attach a secondary ENI.
  • If NetworkInterface.N.InstanceType is set to Primary, this parameter is equivalent to PrivateIpAddress. You cannot specify both NetworkInterface.N.PrimaryIpAddress and PrivateIpAddress.
  • If NetworkInterface.N.InstanceType is set to Secondary or left empty, the specified primary IP address is assigned to the secondary ENI. The default value is an IP address that is randomly selected from within the CIDR block of the vSwitch with which to associate the secondary ENI.
Note You can attach only a single secondary ENI when you create an instance. After the instance is created, you can call the CreateNetworkInterface and AttachNetworkInterface operations to attach more secondary ENIs to the instance.
NetworkInterface.N.SecurityGroupIds.N String No sg-bp67acfmxazb4p****

The ID of security group N to which to assign ENI N.

  • Valid values of the first N: 1 and 2. If the value of the first N is 1, you can configure a primary or secondary ENI. If the value of the first N is 2, you must configure a primary ENI and a secondary ENI.
  • The second N indicates that one or more security group IDs can be specified. The valid values of the second N vary based on the maximum number of security groups to which an instance can belong. For more information, see the "Security group limits" section in Limits.

Take note of the following items:

  • If NetworkInterface.N.InstanceType is set to Primary, this parameter or NetworkInterface.N.SecurityGroupId is required. In this case, this parameter is equivalent to SecurityGroupIds.N. You cannot specify SecurityGroupId, SecurityGroupIds.N, or NetworkInterface.N.SecurityGroupId.
  • If you set NetworkInterface.N.InstanceType to Secondary or leave this parameter empty, NetworkInterface.SecurityGroupIds is optional. The default value is the ID of the security group to which the instance belongs.
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 specify a primary or secondary ENI. If the value of N is 2, you must specify a primary ENI and a secondary ENI.

Valid values:

  • Primary
  • Secondary

Default value: Secondary.

NetworkInterface.N.NetworkInterfaceTrafficMode String No Standard

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.
Tag.N.Key String No TestKey

The key of tag N that you want to add to the instance, EBS device, or ENI. Valid values of N: 1 to 20. The tag key cannot be an empty string. The tag key can be up to 64 characters in length and cannot start with acs: or aliyun. The tag key cannot contain http:// or https://.

Tag.N.Value String No TestValue

The value of tag N what you want to add to the instance, EBS device, or ENI. 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 start with acs: or aliyun. The tag value cannot contain http:// or https://.

SecurityGroupIds.N String No sg-bp15ed6xe1yxeycg7****

The ID of security group N to which the instance belongs. The valid values of N vary based 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 You cannot specify SecurityGroupId and SecurityGroupIds.N at the same time.
SystemDisk.Encrypted String No false

Specifies whether to encrypt the system disk. Valid values:

  • true
  • false

Default value: false.

Note If 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:

  • true
  • false

Default value: false.

Note This parameter applies 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:

  • Standard: 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.

Response parameters

Parameter

Type

Example

Description

LaunchTemplateId String lt-m5eiaupmvm2op9d****

The ID of the launch template.

RequestId String 473469C7-AA6F-4DC5-B3DB-A3DC0DE3****

The ID of the request.

LaunchTemplateVersionNumber Long 2

The version number of the launch template.

Examples

Sample requests

https://ecs.aliyuncs.com/?Action=CreateLaunchTemplate
&LaunchTemplateName=testLaunchTemplateName
&RegionId=cn-hangzhou
&TemplateTag.1.Key=TestKey
&TemplateTag.1.Value=TestValue
&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-bp1s5fnvk4gn2tws03****
&InstanceName=testInstanceName
&Description=testECSDescription
&InternetMaxBandwidthIn=10
&InternetMaxBandwidthOut=10
&HostName=testHostName
&ZoneId=cn-hangzhou-g
&SystemDisk.Category=cloud_ssd
&SystemDisk.Size=40
&SystemDisk.DiskName=testSystemDiskName
&SystemDisk.Description=TestDisk
&DataDisk.1.Size=2000
&DataDisk.1.SnapshotId=s-bp17441ohwka0yuh****
&DataDisk.1.Category=cloud_ssd
&DataDisk.1.Encrypted=false
&DataDisk.1.DiskName=testDataDiskName
&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=testEniName
&NetworkInterface.1.Description=testEniDescription
&PrivateIpAddress=10.1.**.**
&InstanceChargeType=PrePaid
&Period=1
&InternetChargeType=PayByTraffic
&NetworkType=vpc
&UserData=ZWNobyBoZWxsbyBlY3Mh
&RamRoleName=testRamRoleName
&AutoReleaseTime=2018-01-01T12:05:00Z
&SpotStrategy=NoSpot
&SpotPriceLimit=0.97
&SecurityEnhancementStrategy=Deactive
&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

<CreateLaunchTemplateResponse>
    <RequestId>473469C7-AA6F-4DC5-B3DB-A3DC0DE3****</RequestId>
    <LaunchTemplateId>lt-m5eiaupmvm2op9d****</LaunchTemplateId>
    <LaunchTemplateVersionNumber>2</LaunchTemplateVersionNumber>
</CreateLaunchTemplateResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "473469C7-AA6F-4DC5-B3DB-A3DC0DE3****",
  "LaunchTemplateId" : "lt-m5eiaupmvm2op9d****",
  "LaunchTemplateVersionNumber" : "2"
}

Error codes

HttpCode

Error code

Error message

Description

400 InvalidRegion.NotExist %s The specified region does not exist.
400 MissingParameter %s A required parameter is not specified.
400 InvalidParameter %s Invalid parameter value.
400 InvalidLaunchTemplateName.Malformed The specified parameter LaunchTemplateName is not valid. Invalid LaunchTemplateName value.
400 InvalidUserData.SizeExceeded %s The maximum user data size 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.
400 InvalidTagKey.Malformed The specified Tag.n.Key is not valid. Invalid Tag.N.Key value.
400 InvalidTagValue.Malformed The specified Tag.n.Value is not valid. Invalid Tag.N.Value value.
403 LaunchTemplateLimitExceed %s The maximum number of launch templates has been exceeded.
403 LaunchTemplateName.Duplicated %s The specified launch template name already exists.
403 QuotaExceed.Tags %s The maximum number of tags has been exceeded. %s is a variable. An error message is dynamically returned based on the call conditions.
404 InvalidResourceGroup.NotFound The ResourceGroup provided does not exist in our records. The resource group ID does not exist.
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.