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.

Description

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

After you create a launch template (CreateLaunchTemplate), its version number is set to 1 by default. You can create multiple versions (CreateLaunchTemplateVersion) 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 (RunInstances), the default version is used.

When you call this operation, 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 validity of the parameter values are verified only when you use the launch template to create instances.
  • If you set a specific parameter in a launch template, you cannot filter out this parameter when you use the launch template to create instances (RunInstances). For example, if you set the HostName parameter to LocalHost in a launch template and do not set the HostName parameter when you call the RunInstances operation to create instances from the launch template, the created instance still has a hostname of 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

ParameterTypeRequiredExampleDescription
ActionStringYesCreateLaunchTemplate

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

RegionIdStringYescn-hangzhou

The ID of the region in which to create the launch template. You can call the DescribeRegions operation to query the most recent region list.

TemplateTag.N.KeyStringNoTestKey

The key of tag N to add to the launch template. Valid values of N: 1 to 20. The tag key cannot 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://.

TemplateTag.N.ValueStringNoTestValue

The value of tag N to add to the launch template. Valid values of N: 1 to 20. 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://.

LaunchTemplateNameStringYestestLaunchTemplateName

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 (-).

VersionDescriptionStringNotestVersionDescription

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

ImageIdStringNowin2008r2_64_ent_sp1_en-us_40G_alibase_20170915.vhd

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

ImageOwnerAliasStringNosystem

The source of the image. Valid values:

  • system: public images provided by Alibaba Cloud.
  • self: custom images that you create.
  • others: shared images from other Alibaba Cloud accounts.
  • marketplace: Alibaba Cloud Marketplace images. If Alibaba Cloud Marketplace images are found, you can use these images without prior subscription. You must pay attention to the billing details of Alibaba Cloud Marketplace images.
PasswordInheritBooleanNofalse

Specifies whether to use the password preset in the image.

Note When you use this parameter, leave Password empty and make sure that the selected image has a password preset.
InstanceTypeStringNoecs.g5.large

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

SecurityGroupIdStringNosg-bp15ed6xe1yxeycg****

The ID of the security group to which to assign the instance. Instances in the same security group can communicate with each other. A security group can contain up to 1,000 instances.

Note You cannot specify both the SecurityGroupId and SecurityGroupIds.N parameters.
VpcIdStringNovpc-bp12433upq1y5scen****

The ID of the virtual private cloud (VPC).

VSwitchIdStringNovsw-bp1s5fnvk4gn2tws0****

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

InstanceNameStringNotestInstanceName

The name of the instance. 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 (-).

DescriptionStringNotestECSDescription

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

InternetMaxBandwidthInIntegerNo10

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.
  • When 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.
InternetMaxBandwidthOutIntegerNo10

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

HostNameStringNotestHostName

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 (-).
ZoneIdStringNocn-hangzhou-g

The ID of the zone in which to create the instance.

SystemDisk.CategoryStringNocloud_ssd

The category of the system disk. Valid values:

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

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

SystemDisk.SizeIntegerNo40

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.

SystemDisk.DiskNameStringNotestSystemDiskName

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 (-).

SystemDisk.DescriptionStringNotestSystemDiskDescription

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

SystemDisk.IopsIntegerNonull
Note This parameter is currently in invitational preview and unavailable for general users.
SystemDisk.PerformanceLevelStringNoPL0

The performance level of the ESSD to use 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.

SystemDisk.DeleteWithInstanceBooleanNotrue

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

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

Default value: true.

SystemDisk.AutoSnapshotPolicyIdStringNosp-gc7c37d4ylw7mtnk****

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

SystemDisk.ProvisionedIopsLongNo50000

The provisioned read/write IOPS of the ESSD AutoPL disk to use as the system 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 the SystemDisk.Category parameter to cloud_auto. For more information, see ESSD AutoPL disks and Modify the performance configurations of an ESSD AutoPL disk.
SystemDisk.BurstingEnabledBooleanNotrue

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

  • true: enables the performance burst feature.
  • false: does not enable the performance burst feature.
IoOptimizedStringNooptimized

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

  • none: The instance is not I/O optimized.
  • optimized: The instance is I/O optimized.
InstanceChargeTypeStringNoPrePaid

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

The subscription duration 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.

InternetChargeTypeStringNoPayByTraffic

The billing method for network usage. 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 bandwidth values are used as 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.
EnableVmOsConfigBooleanNofalse

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

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

The network type of the instance. Valid values:

  • classic: classic network
  • vpc: VPC
UserDataStringNoZWNobyBoZWxsbyBlY3Mh

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

KeyPairNameStringNotestKeyPairName

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

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.

AutoReleaseTimeStringNo2018-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 seconds (ss) is not 00, the time is automatically rounded to the nearest minute based on the value of minutes (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.
SpotStrategyStringNoNoSpot

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

  • NoSpot: The instance is created as a regular pay-as-you-go instance.
  • SpotWithPriceLimit: The instance is created as a preemptible instance with a user-defined 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.
SpotPriceLimitFloatNo0.97

The maximum hourly price of the instance. The value is accurate to three decimal places. This parameter is valid only when the SpotStrategy parameter is set to SpotWithPriceLimit.

SpotDurationIntegerNo1

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

  • The following protection periods are 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.
  • If this parameter is set to 0, no protection period is configured for the preemptible instance.

Default value: 1.

ResourceGroupIdStringNorg-bp67acfmxazb4p****

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

TemplateResourceGroupIdStringNorg-bp67acfmxazb4p****

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

SecurityEnhancementStrategyStringNoDeactive

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

  • Active: enables security hardening. This value is applicable only to public images.
  • Deactive: disables security hardening. This value is applicable to all image types.
PrivateIpAddressStringNo10.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 the VSwitchId parameter.

DeploymentSetIdStringNods-bp1brhwhoqinyjd6****

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

Ipv6AddressCountIntegerNo1

The number of IPv6 addresses to randomly generate for the primary ENI. Valid values: 1 to 10.

DataDisk.N.PerformanceLevelStringNoPL1

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

DataDisk.N.DescriptionStringNotestDataDiskDescription

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.SnapshotIdStringNos-bp17441ohwka0yuh****

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

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

DataDisk.N.SizeIntegerNo2000

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

  • Valid values when DataDisk.N.Category is set to cloud: 5 to 2000
  • Valid values when DataDisk.N.Category is set 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.

DataDisk.N.DeviceStringNonull
Note This parameter will be removed in the future. We recommend that you use other parameters to ensure future compatibility.
DataDisk.N.DiskNameStringNotestDataDiskName

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 (-).

DataDisk.N.CategoryStringNocloud_ssd

The category of data disk N. Valid values:

  • cloud: basic disk
  • cloud_efficiency: ultra disk
  • cloud_ssd: standard SSD
  • 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.

DataDisk.N.DeleteWithInstanceBooleanNotrue

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.

DataDisk.N.EncryptedStringNofalse

Specifies whether to encrypt data disk N.

DataDisk.N.AutoSnapshotPolicyIdStringNosp-m5e7fa9ute44ssa****

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

DataDisk.N.ProvisionedIopsLongNo50000

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 DataDisk.N.Category parameter to cloud_auto. For more information, see ESSD AutoPL disks and Modify the performance configurations of an ESSD AutoPL disk.
DataDisk.N.BurstingEnabledBooleanNotrue

Specifies whether to enable the performance burst feature for data disk N. Valid values:

  • true: enables the performance burst feature.
  • false: does not enable the performance burst feature.
NetworkInterface.N.VSwitchIdStringNovsw-bp1s5fnvk4gn2tws0****

The ID of the vSwitch to which to connect ENI N.

Take note of the following items:

  • 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 can configure a primary ENI and a secondary ENI.
  • If NetworkInterface.N.InstanceType is set to Primary, this parameter is required. In this case, this parameter is equivalent to VSwitchId and you cannot specify VSwitchId.
  • If NetworkInterface.N.InstanceType is set to Secondary or left empty, this parameter is optional. The default value is the ID of the vSwitch to which to connect the ECS instance.
NetworkInterface.N.NetworkInterfaceNameStringNotestEniName

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, you can configure a primary or secondary ENI. If the value of N is 2, you can configure a primary ENI and a secondary ENI.
  • If NetworkInterface.N.InstanceType is set to Primary, you do not need to set this parameter.
NetworkInterface.N.DescriptionStringNotestEniDescription

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.

NetworkInterface.N.SecurityGroupIdStringNosg-bp15ed6xe1yxeycg****

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

Take note of the following items:

  • 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 can configure a primary ENI and a secondary ENI.
  • If NetworkInterface.N.InstanceType is set to Primary, this parameter is required. In this case, this parameter is equivalent to SecurityGroupId and you cannot specify SecurityGroupId, SecurityGroupIds.N, or NetworkInterface.N.SecurityGroupIds.N.
  • If NetworkInterface.N.InstanceType is set to Secondary or left empty, this parameter is optional. The default value is the ID of the security group to which to assign the ECS instance.
NetworkInterface.N.PrimaryIpAddressStringNo192.168.**.**

The primary IP address to assign to ENI N.

Take note of the following items:

  • Valid values of N: 1 and 2.
    • If the value of N is 1, you can configure 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, you can configure a primary ENI and a 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, you cannot set NetworkInterface.2.InstanceType to Secondary to bind a secondary ENI.
  • If NetworkInterface.N.InstanceType is set to Primary, this parameter is equivalent to PrivateIpAddress and you cannot specify 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 to which to connect the secondary ENI.
Note You can bind only a single secondary ENI when you create an instance. After the instance is created, you can call the CreateNetworkInterface and AttachNetworkInterface operations to bind more secondary ENIs.
NetworkInterface.N.SecurityGroupIds.NStringNosg-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 N is 1, you can configure a primary or secondary ENI. If the value of N is 2, you can 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 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, you must set this parameter or NetworkInterface.N.SecurityGroupId. In this case, this parameter is equivalent to SecurityGroupIds.N and you cannot specify SecurityGroupId, SecurityGroupIds.N, or NetworkInterface.N.SecurityGroupId.
  • If NetworkInterface.N.InstanceType is set to Secondary or left empty, this parameter is optional. The default value is the ID of the security group to which to assign the ECS instance.
NetworkInterface.N.InstanceTypeStringNoSecondary

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 can configure a primary ENI and a secondary ENI. Valid values: Primary and Secondary. Default value: Secondary.

NetworkInterface.N.NetworkInterfaceTrafficModeStringNoStandard

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

The key of tag N to add to the instance, EBS device, or ENI. Valid values of N: 1 to 20. 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://.

Tag.N.ValueStringNoTestValue

The value of tag N to add to the instance, EBS device, or ENI. Valid values of N: 1 to 20. 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://.

SecurityGroupIds.NStringNosg-bp15ed6xe1yxeycg7****

The ID of security group N to which to assign the instance. The valid values of N are based on the maximum number of security groups to which the instance can belong. For more information, see the "Security group limits" section in Limits.

Note You cannot specify both SecurityGroupId and SecurityGroupIds.N.

Response parameters

ParameterTypeExampleDescription
LaunchTemplateIdStringlt-m5eiaupmvm2op9d****

The ID of the launch template.

RequestIdString473469C7-AA6F-4DC5-B3DB-A3DC0DE3****

The ID of the request.

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>
</CreateLaunchTemplateResponse>

JSON format

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

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

Error codes

HTTP status codeError codeError messageDescription
400InvalidRegion.NotExist%sThe error message returned because the specified RegionId parameter does not exist.
400MissingParameter%sThe error message returned because a required parameter is not specified.
400InvalidParameter%sThe error message returned because a specified parameter is invalid.
400InvalidLaunchTemplateName.MalformedThe specified parameter LaunchTemplateName is not valid.The error message returned because the specified LaunchTemplateName parameter is invalid.
400InvalidUserData.SizeExceeded%sThe error message returned because the size of the specified user data exceeds the upper limit.
400InvalidUserData.Base64FormatInvalid%sThe error message returned because the specified UserData parameter is invalid.
400Duplicate.TagKeyThe Tag.N.Key contain duplicate key.The error message returned because the specified tag key already exists. Tag keys must be unique.
400InvalidTagKey.MalformedThe specified Tag.n.Key is not valid.The error message returned because the specified Tag.N.Key parameter is invalid.
400InvalidTagValue.MalformedThe specified Tag.n.Value is not valid.The error message returned because the specified Tag.N.Value parameter is invalid.
403LaunchTemplateLimitExceed%sThe error message returned because the maximum number of launch templates has been reached.
403LaunchTemplateName.Duplicated%sThe error message returned because the specified launch template name already exists.
403QuotaExceed.Tags%sThe error message returned because the number of specified tags exceeds the upper limit. %s is a variable. An error message is dynamically returned based on call conditions.
404InvalidResourceGroup.NotFoundThe ResourceGroup provided does not exist in our records.The error message returned because the specified resource group does not exist.
500InternalErrorThe request processing has failed due to some unknown error.The error message returned because an internal error has occurred. Try again later.

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