You need to enable JavaScript to run this app.
导航

AllocateDedicatedHosts

最近更新时间2024.04.22 11:34:50

首次发布时间2024.04.22 11:34:50

调用 AllocateDedicatedHosts 接口创建一台或多台包年包月的专有宿主机。

请求参数

名称
类型是否必填
示例值
描述
ActionStringAllocateDedicatedHosts要执行的操作,取值:AllocateDedicatedHosts。
VersionString2020-04-01API的版本,取值: 2020-04-01。
ZoneIdStringcn-beijing-a专有宿主机所在可用区ID。
您可以调用DescribeZones查询一个地域下的可用区信息。

AutoPlacement

String

Off

专有宿主机是否加入自动部署资源池,取值:

  • On:加入自动部署资源池。创建实例时可以不指定DDH,由系统从自动部署池中选择合适的DDH部署实例。

  • Off(默认):不加入自动部署资源池。您需自行在DDH上部署实例,即创建实例时指定DDH。

创建实例操作请参见RunInstances

ChargeType

String

PostPaid

专有宿主机的计费类型,取值:

PrePaid:包年包月。

Period

Integer

12

购买资源的时长。
取值:1、2、3、4、5、6、7、8、9、12、24、36

PeriodUnit

String

Month

购买资源的时长单位。
取值:Month。

AutoRenew

Boolean

true

专有宿主机到期后是否自动续费。

  • true:自动续费。

  • false(默认):不自动续费。

AutoRenewPeriod

Integer

1

每次自动续费的时长。

  • 当参数AutoRenew取值为True时,该参数有效,默认值为1。

  • PeriodUnit取值为Month时,AutoRenewPeriod取值为1、2、3、6、12。

Count

Integer

1

创建数量,取值范围:1~100。
传入0时,会默认为1。

CpuOvercommitRatio

Float32

4

CPU超分比,用于提升DDH的可用vCPU数,一台DDH的可用vCPU数 = 物理CPU核数 * 2 * CPU超分比。

DedicatedHostName

String

dedicated-host

专有宿主机的名称。

  • 不能以数字、下划线“_”、中划线“-”开头。

  • 只能包含中文、字母、数字、下划线“_”和中划线“-”。

  • 长度限制为1~128个字符。

  • 暂不支持特殊字符。

DedicatedHostTypeIdStringecs.ddhr2s专有宿主机规格ID。可以通过DescribeDedicatedHostTypes接口获取。

Description

String

用于测试的专有宿主机

专有宿主机的描述,默认值为空字符串。

  • 必须以字母或中文开头。

  • 只能包含中文、字母、数字、点“.”、空格、下划线“_”、中划线“-”、等号“=”、英文逗号“,”、中文逗号“,”和中文句号“。”

  • 长度限制在255个字符以内。

DedicatedHostRecovery

String

On

专有宿主机处于临时不可用(TempUnavailable)状态时,是否开启宕机自动迁移,取值:

  • On:开启宕机自动迁移。开启后,宿主机宕机时会自动迁移至健康的DDH。

  • Off(默认):不开启宕机自动迁移。可以调用RedeployDedicatedHost手动更换物理机。

ClientToken

String

333456899ff****

保证请求幂等性。由客户端自动生成一个参数值,确保不同请求间该参数值唯一,避免当调用API超时或服务器内部错误时,客户端多次重试导致重复性操作。
取值:仅支持ASCII字符,且不能超过64个字符。

DryRun

Boolean

false

是否只预检此次请求。取值:

  • true:发送检查请求,不会创建专有宿主机。检查项包括是否填写了必需参数、请求格式、业务限制和资源库存。如果检查不通过,则返回对应错误。如果检查通过,则返回错误码DryRunOperation

    说明

    DryRun取值为true时,若传入了Count参数,则取值必须为1。

  • false(默认):发送正常请求,通过检查后直接创建专有宿主机。

DedicatedHostMaintenance

String

-

是否开启亚健康自动处理,取值:

  • Off(默认):关闭亚健康自动处理。

  • On:开启亚健康自动处理。

ProjectName

String

project_a

资源所属项目,默认为空。一个资源只能归属于一个项目。

  • 只能包含字母、数字、下划线“_”、点“.”和中划线“-”。

  • 长度限制在64个字符以内。

Tags.N.Key

String

Tags.1.Key=k1&Tags.2.Key=k2

用户标签的标签键。

  • 参数 - N:表示标签键的序号,取值范围:1~20。

  • 多个标签键之间用&分隔。

命名规则如下:

  • 不能以volc:的任意大小写组合开头。

  • 只能包含语言字符、数字、空格和英文符号“_”、“.”、“:”、“/”、“=”、“+”、“-”、“@”。

  • 长度限制在1~128个字符之间。

同一资源的标签键不允许重复。

Tags.N.Value

String

Tags.1.Value=v1&Tags.2.Value=v2

用户标签的标签值。

  • 参数 - N:表示标签值的序号,取值范围:1~20。

  • 多个标签值之间用&分隔。

命名规则如下:

  • 只能包含语言字符、数字、空格和英文符号“_”、“.”、“:”、“/”、“=”、“+”、“-”、“@”。

  • 允许为空,长度限制在0~256个字符之间。

如果传入该参数,则必须先传入Tags.N.Key

返回数据

名称类型示例值说明
DedicatedHostIdsStringdh-3tigy72q3u3vj0x2****专有宿主机ID。

请求示例

GET /?Action=AllocateDedicatedHosts&Version=2020-04-01&ZoneId=cn-beijing-a&DedicatedHostTypeId=ecs.ddhr2s&DedicatedHostName=dedicated-host&Count=1&ChargeType=PrePaid&Period=1&PeriodUnit=Month HTTP/1.1
Host: open.volcengineapi.com
Region: cn-beijing
Service: ecs

返回示例

{
    "ResponseMetadata": {
        "RequestId": "202307141717540EC59BF6CDCC7C44****",
        "Action": "AllocateDedicatedHosts",
        "Version": "2020-04-01",
        "Service": "ecs",
        "Region": "cn-beijing"
    },
    "Result": {
        "DedicatedHostIds": [
            "dh-3tigy72q3u3vj0x2****"
        ]
    }
}

错误码

HttpCode错误码错误信息描述
400Insufficient.BalanceThe request is denied due to the lack of balance.账户余额不足。
400InvalidArgumentThe specified argument is invalid.指定的参数不合法。
400InvalidAutoPlacement.MalformedThe specified AutoPlacement is malformed.指定的AutoPlacement不合法。
400InvalidChargeType.MalformedThe specified ChargeType is malformed.指定的计费类型不合法。
400InvalidCount.MalformedThe specified count is malformed.指定的参数Count不合法。

400

InvalidCpuOvercommitRatio.Malformed

The specified CpuOvercommitRatio is malformed.

指定的CPU超分比不合法。

400

InvalidDedicatedHostName.Malformed

The specified DedicatedHostName is malformed.

指定的DedicatedHostName不合法。

400InvalidDescription.MalformedThe specified Description is malformed.指定的描述不合法。
400InvalidPeriod.MalformedThe specified period is malformed.指定的计费周期不合法。
400InvalidPeriodUnit.MalformedThe specified PeriodUnit is malformed.指定的计费周期单位不合法。
400MissingParameter.DedicatedHostNameThe required parameter DedicatedHostName is not supplied.参数DedicatedHostName不能为空。

400

MissingParameter.DedicatedHostTypeId

The required parameter DedicatedHostTypeId is not supplied.

参数DedicatedHostTypeId不能为空。

400

MissingParameter.ZoneId

The required parameter ZoneId is not supplied.

可用区ID不能为空。

400

QuotaExceeded.MaximumDedicatedHosts

You've reached the limit on the number of dedicated hosts that you can allocate, please submit ticket to request an increase in quota.

专有宿主机规格数量配额不足,请提工单申请提高配额。

400

InvalidDedicatedHostRecovery.Malformed

The specified DedicatedHostRecovery is malformed.

指定的DedicatedHostRecovery不合法。

400InvalidClientToken.MalformedThe specified ClientToken is malformed.指定的ClientToken不合法。

400

IdempotentParameterMismatch

The request uses the same client token as a previous, but non-identical request. Do not reuse a client token with different requests, unless the requests are identical.

幂等参数不一致。

400

InvalidDedicatedHostMaintenance.Malformed

The specified DedicatedHostMaintenance is malformed.

指定的DedicatedHostMaintenance不合法。

404

InvalidDedicatedHostType.NotFound

The specified DedicatedHostTypeId does not exist.

指定的专有宿主机规格不存在。

404InvalidZone.NotFoundThe specified zone does not exist.指定的可用区不存在。

412

IdempotentProcessing

The request uses the same client token as a previous one that is still in process.

先前的幂等请求仍在处理中,请稍后重试。

412DryRunOperationYour request has been validated by the DryRunOperation.通过“DryRun”校验,您的请求已通过验证。
500Insufficient.DedicatedHostCapacityThere is not enough capacity to fulfill your request.当前资源不足,请稍后重试或选择其它专有宿主机规格。
500InternalErrorAn internal error has occurred.内部错误,请重试。如果多次尝试失败,请提交工单。