AllocateHosts

Last updated: 2019-12-05 20:41:20

1. API Description

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

This API is used to create CDH instances with specified configuration.

  • When HostChargeType is PREPAID, the HostChargePrepaid parameter must be specified.

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

Note: This API supports Finance regions. If the common parameter Region is a Finance region, a domain name with the Finance region needs to be specified, for example: cvm.ap-shanghai-fsi.tencentcloudapi.com

2. Input Parameters

The following request parameter list only provides API request parameters and some common parameters.

Parameter Name Required Type Description
Action Yes String Common parameter. The value used for this API: AllocateHosts
Version Yes String Common parameter. The value used for this API: 2017-03-12
Region Yes String Common parameter.
Placement Yes Placement Instance location. This parameter is used to specify the attributes of an instance, such as its availability zone and project.
ClientToken No String A string used to ensure the idempotency of the request.
HostChargePrepaid No ChargePrepaid Configuration of prepaid instances. You can use the parameter to specify the attributes of prepaid instances, such as the subscription period and the auto-renewal plan. This parameter is required for prepaid instances.
HostChargeType No String The billing method of an instance. Currently only PREPAID is supported.
HostType No String CDH instance model. Default value: HS1.
HostCount No Integer The quantity of CDH instances you want to purchase.
TagSpecification.N No Array of TagSpecification Tag description. You can specify the parameter to associate a tag with an instance.

3. Output Parameters

Parameter Name Type Description
HostIdSet Array of String The ID list of the CVM instances newly created on the CDH.
RequestId String The unique request ID, which is returned for each request. RequestId is required for locating a problem.

4. Example

Example1 Purchasing a prepaid CDH instance

This example shows you how to purchase a prepaid CDH instance.

Input Example

GET https://cvm.tencentcloudapi.com/?Action=AllocateHosts
&Placement.Zone=ap-guangzhou-2
&HostChargeType=PREPAID
&HostChargePrepaid.Period=1
&HostChargePrepaid.RenewFlag=NOTIFY_AND_AUTO_RENEW
&HostType=HS1
&HostCount=1
&<Common request parameters>

Output Example

{
  "Response": {
    "HostIdSet": [
      "host-lan4lb2k"
    ],
    "RequestID": "3c140219-cfe9-470e-b241-907877d6fb03"
  }
}

5. Developer Resources

API Explorer

This tool allows online call, signature authentication, SDK code generation and quick search of APIs to greatly improve the efficiency of using TencentCloud APIs.

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
InvalidPeriod Invalid period. Valid values: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 24, 36]; unit: month.
InvalidProjectId.NotFound Invalid project ID: the specified project ID does not exist.
InvalidRegion.NotFound The region cannot be found.
InvalidZone.MismatchRegion The specified zone does not exist.