tencent cloud

Feedback

RunInstances

Last updated: 2023-08-18 14:28:07

1. API Description

Domain name for API request: ecm.tencentcloudapi.com.

This API is used to create an ECM instance.

A maximum of 20 requests can be initiated per second for this API.

We recommend you to use API Explorer
Try it
API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

2. Input Parameters

The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

Parameter Name Required Type Description
Action Yes String Common Params. The value used for this API: RunInstances.
Version Yes String Common Params. The value used for this API: 2019-07-19.
Region No String Common Params. This parameter is not required for this API.
ZoneInstanceCountISPSet.N Yes Array of ZoneInstanceCountISP List of AZs in which to create instances, the number of instances to be created, and the ISPs. You can create up to 100 instances in a region at a time.
Password No String Instance login password. Different OS types have different limits on password complexity as detailed below:
The password of a Linux instance must contain 8–30 characters in at least two of the following character types: letters, digits, and special symbols [( ) ~ ! @ # $ % ^ & - + = | { } [ ] : ; ' , . ? / ]. The password of a Windows instance must contain 12–30 characters in at least three of the following character types: letters, digits, and special symbols [( ) ~ ! @ # $ % ^ & - + = | { } [ ] : ; ' , . ? /].
InternetMaxBandwidthOut No Integer Public network outbound bandwidth cap in Mbps.
1. If you don't specify this parameter or specify it as 0, the default value under the corresponding module will be used.
2. If you don't specify this parameter or specify it as 0 without specifying the module, the value of InternetMaxBandwidthIn will be used
ModuleId No String Module ID. If you don't specify this parameter, you must specify the ImageId, InstanceType, DataDiskSize, and InternetMaxBandwidthOut parameters
ImageId No String Image ID. If you don't specify this parameter or specify it as null, the default value under the corresponding module will be used.
InstanceName No String Instance display name.
If this parameter is not specified, Not named will be displayed by default.
If you purchase multiple instances and specify the pattern string {R:x}, display names will be generated based on [x, x+n-1], where n is the number of the purchased instances. For example, if you specify server\_{R:3} and purchase 1 instance, the display name will be server\_3, and if you purchase 2 instances, the display names will be server\_3 and server\_4 respectively.
You can specify multiple pattern strings {R:x}.
If you purchase multiple instances and don't specify the pattern string, the instance display names will be suffixed with 1, 2...n, where n indicates the number of the purchased instances. For example, if you specify server_ and purchase 2 instances, the instance display names will be server\_1 and server\_2 respectively.
If the purchased instances belong to different regions or ISPs, the above rules will apply to each region and ISP independently.
It can contain up to 60 characters (including pattern string).
HostName No String Server name
HostName cannot start or end with a dot or hyphen and cannot contain consecutive dots or hyphens.
Windows instance: the name can contain 2–15 letters, digits, and hyphens but not dots or only digits.
Other types (such as Linux) of instances: the name should be a combination of 2 to 60 characters, supporting multiple dots. A string between two dots can contain letters, digits, and hyphens.
ClientToken No String The string used to ensure the idempotency of the request. Currently, it is a reserved parameter; therefore, do not use it.
EnhancedService No EnhancedService Enhanced services. You can use this parameter to specify whether to enable services such as Cloud Security and Cloud Monitor. If this parameter is not specified, Cloud Monitor and Cloud Security will be enabled for public images by default.
TagSpecification.N No Array of TagSpecification Tag list
UserData No String The user data provided to the instance, which needs to be Base64-encoded with a maximum size of 16 KB
InstanceType No String Model. If you don't specify this parameter or specify it as null, the default value under the corresponding module will be used.
DataDiskSize No Integer Data disk size in GB. If you don't specify this parameter or specify it as 0, the default value under the corresponding module will be used
SecurityGroupIds.N No Array of String Security group of the instance, which can be obtained from the sgId field in the returned value of the DescribeSecurityGroups API. If this parameter is not specified, the default security group will be bound by default.
SystemDiskSize No Integer System disk size in GB. If you don't specify this parameter or specify it as 0, the default value under the corresponding module will be used
InternetMaxBandwidthIn No Integer Public network inbound bandwidth cap in Mbps.
1. If you don't specify this parameter or specify it as 0, the default value under the corresponding module will be used.
2. If you don't specify this parameter or specify it as 0 without specifying the module, the value of InternetMaxBandwidthOut will be used
InstanceChargeType No Integer Instance billing type. Valid values:
0: postpaid by resource usage, where the daily peak usage of the CPU, memory, and disk will be calculated. This billing mode applies only to non-GNR models;
1: hourly postpaid at the unit price of xx USD/instance/hour. This billing mode applies only to GNR models. To enable it, submit a ticket for application;
2: monthly postpaid at the unit price of xx USD/instance/month. This billing mode applies only to GNR models;
If this field is left empty, 0 will be selected by default for non-GNR models, and 2 will be selected by default for GNR models.
KeyIds.N No Array of String Key pair.
KeepImageLogin No String Whether to keep the original settings for the image. You cannot specify this parameter if Password or KeyIds.N is specified. You can specify this parameter as TRUE only when you create an instance by using a custom image, shared image, or image imported from an external resource. Valid values:
TRUE: yes
FALSE: no

Default value: FALSE.
Note: this field may return null, indicating that no valid values can be obtained.
SystemDisk No SystemDisk System disk information.
DataDisks.N No Array of DataDisk Data disk information.

3. Output Parameters

Parameter Name Type Description
InstanceIdSet Array of String List of IDs of the instances being created
Note: this field may return null, indicating that no valid values can be obtained.
RequestId String The unique request ID, which is returned for each request. RequestId is required for locating a problem.

4. Example

Example1 Creating instance

Input Example

https://ecm.tencentcloudapi.com/?Action=RunInstances
&ZoneInstanceCountISPSet.0.Zone=ap-zhengzhou-1
&ZoneInstanceCountISPSet.0.InstanceCount=2
&ZoneInstanceCountISPSet.0.ISP=CMCC
&ZoneInstanceCountISPSet.1.Zone=ap-qingdao-1
&ZoneInstanceCountISPSet.1.InstanceCount=1
&ZoneInstanceCountISPSet.1.ISP=CUCC
&InternetMaxBandwidthOut=50
&ImageId=img-q9fy0if9
&HostName=oldhen_4986
&ModuleId=em-0vag13d1
&InstanceName=Live on-screen commenting
&EnhancedService.SecurityService.Enabled=false
&EnhancedService.MonitorService.Enabled=false
&InstanceChargeType=0
&<Common request parameters>

Output Example

{
    "Response": {
        "RequestId": "d40cdb72-7bc0-4b48-b3aa-25e8401f6999",
        "InstanceIdSet": [
            "ein-197252sp",
            "ein-19725win",
            "ein-19623ash"
        ]
    }
}

5. Developer Resources

SDK

TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

Command Line Interface

6. Error Code

The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

Error Code Description
FailedOperation.BlockBalance Insufficient balance.
FailedOperation.InternalOperationFailure Internal error.
FailedOperation.OperationConflict The current operation cannot be performed as another operation is being performed.
InvalidParameter.InvalidDataFormat The data format is incorrect.
InvalidParameter.ParameterConflict Only KeepImageLogin, Password, or KeyIds can be used at a time.
InvalidParameterValue The parameter value is incorrect.
InvalidParameterValue.AddressQuotaLimitExceeded The number applied for exceeds the limit.
InvalidParameterValue.Duplicate The data is duplicate.
InvalidParameterValue.FilterLimitExceeded The value of the Filter parameter exceeds the limit.
InvalidParameterValue.ImageSizeLargeThanSysDiskSize The image size is greater than the system disk size.
InvalidParameterValue.InstanceConfigNotMatch The instance configuration does not match.
InvalidParameterValue.InstanceNameTooLong The instance name length exceeds the limit.
InvalidParameterValue.InstanceTypeNotMatchPid The instance model and pid do not match.
InvalidParameterValue.InvaildHostName HostName is invalid.
InvalidParameterValue.InvaildModifyParam The parameter is incorrect.
InvalidParameterValue.InvaildPassword The password is invalid.
InvalidParameterValue.InvalidBandwidth The bandwidth size is invalid.
InvalidParameterValue.InvalidBandwidthIn The inbound bandwidth size exceeds the limit.
InvalidParameterValue.InvalidBandwidthInAndOut The inbound and outbound bandwidth must be the same.
InvalidParameterValue.InvalidBillingType The selected billing mode is not supported.
InvalidParameterValue.InvalidDataDiskNum The number of data disks is invalid.
InvalidParameterValue.InvalidDataDiskSize The data disk size is invalid.
InvalidParameterValue.InvalidDataDiskType The data disk type is invalid.
InvalidParameterValue.InvalidEIPDirectService Windows images do not support IP direct access.
InvalidParameterValue.InvalidISPInNode The ISP is invalid.
InvalidParameterValue.InvalidImageArchitecture Models with a memory of 4 GB or above do not support 32-bit OS images.
InvalidParameterValue.InvalidImageID The image ID is invalid.
InvalidParameterValue.InvalidInstanceChargeType The billing mode of the instance is invalid.
InvalidParameterValue.InvalidInstanceTypeConfigID The model ID is invalid.
InvalidParameterValue.InvalidInternetChargeType The billing mode is invalid.
InvalidParameterValue.InvalidModuleID The module ID is invalid.
InvalidParameterValue.InvalidModuleIDAndInstanceTypeConfigID The ModuleId and InstanceType parameters cannot be both empty.
InvalidParameterValue.InvalidModuleIDAndInstanceTypeID The ModuleId and InstanceType parameters cannot be both empty.
InvalidParameterValue.InvalidPublicParam The common parameter is invalid.
InvalidParameterValue.InvalidSecurityGroupID The security group ID is invalid.
InvalidParameterValue.InvalidSystemDiskSize The system disk size is invalid.
InvalidParameterValue.InvalidSystemDiskType The system disk type is invalid.
InvalidParameterValue.InvalidZone The zone is invalid.
InvalidParameterValue.InvalidZoneInstanceCount The city or quantity is invalid.
InvalidParameterValue.InvalidZoneInstanceType This model is not supported in the AZ.
InvalidParameterValue.NodeNotSupportIPv6 The node does not support IPv6.
InvalidParameterValue.ParameterValueTooLarge The parameter value exceeds the limit.
InvalidParameterValue.SubnetNotExist
InvalidParameterValue.TooLong The parameter value is too long.
InvalidParameterValue.UnmatchedBillingType The model does not support the selected billing mode.
InvalidParameterValue.UserNotSupportIPv6 IPv6 is not supported.
LimitExceeded.AddressQuotaLimitExceeded The number applied for exceeds the limit.
LimitExceeded.EniQuotaLimitExceeded The number of purchasable ENIs is insufficient.
LimitExceeded.InstanceSecurityGroupLimitExceeded The number of security groups bound to the instance exceeds the limit.
LimitExceeded.NicOrIPLimitExceeded The number of ENIs or public IPs exceeds the limit specified by the CPU.
LimitExceeded.SecurityGroupInstanceLimitExceeded The number of instances bound to the security group exceeds the limit.
LimitExceeded.VcpuLimitExceeded The number of CPU cores applied for exceeds the limit.
ResourceInUse The resource is in use.
ResourceInsufficient.IPQuotaNotEnough Insufficient IP resource.
ResourceInsufficient.InstanceQuotaNotEnough The instance resource is insufficient.
ResourceInsufficient.PrivateIPQuotaNotEnough
ResourceNotFound The resource does not exist.
ResourcesSoldOut.SpecifiedInstanceType
UnauthorizedOperation.ForbiddenOperation You don't have the permission to perform this operation.
UnsupportedOperation.InstanceTypeNotSupportImage The current model does not support the selected image.
Contact Us

Contact our sales team or business advisors to help your business.

Technical Support

Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

7x24 Phone Support