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

ModifyInstanceChargeType

最近更新时间2024.01.12 08:03:58

首次发布时间2021.10.31 07:37:16

调用 ModifyInstanceChargeType 接口转换实例的计费方式,支持在按量计费和包年包月之间相互转换。

说明

  • 按量计费实例转换为包年包月时,系统盘计费方式默认同步转换,数据盘可以选择是否将当前挂载的按量计费数据盘转换为包年包月数据盘。
  • 包年包月实例转换为按量计费时,系统盘以及实例上挂载的包年包月数据盘将同步转换为按量计费。
  • 本操作不适用于实例上已绑定的公网IP。

调试

请求参数

名称类型是否必填示例值
描述
ActionStringModifyInstanceChargeType要执行的操作,取值:ModifyInstanceChargeType。
VersionString2020-04-01API的版本,取值:2020-04-01。

InstanceIds.N

String

i-3thhlu8byl4bwbha****

实例ID,最多支持20个ID。

  • 参数 - N:表示实例的序号。

  • 多个Instance ID之间用&分隔。

IncludeDataVolumes

Boolean

true

是否将实例上挂载的所有按量计费数据盘转换为包年包月数据盘。

  • true:转换。

  • false (默认):不转换。

AutoPay

Boolean

true

是否自动支付,取值:

  • true:自动支付。您需要确保账户余额充足,如果账户余额不足会生成异常订单,计费方式转换失败。

  • false(默认):仅生成订单但不扣费,您可以在生成订单后,登录火山引擎订单管理页面完成支付。

说明

如果您的支付方式余额不足,建议将本参数设置为false

InstanceChargeType

String

PrePaid

实例需要修改的目标计费方式,取值:

  • PrePaid(默认):将按量计费实例转换为包年包月实例。

  • PostPaid:将包年包月实例转换为按量计费实例。

Period

Integer

2

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

说明

InstanceChargeType取值为PrePaid时,该参数生效且为必选值。

PeriodUnit

String

Month

购买资源时长的时间单位,即参数Period的单位,取值:

  • Month(默认)

  • Week(暂不支持)

AutoRenew

Boolean

true

实例到期后是否自动续费,取值:

  • true:自动续费

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

说明

仅当参数InstanceChargeType取值为PrePaid时生效。

AutoRenewPeriod

Integer

1

每次自动续费的时长。

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

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

ClientToken

String

333456899ff****

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

返回数据

名称类型示例值
描述
OrderIdStringOrder7021038849342******订单号。

请求示例

GET /?Action=ModifyInstanceChargeType&Version=2020-04-01&InstanceIds.1=i-4ay51iinvo8w4nho****&InstanceChargeType=PrePaid&PeriodUnit=Month&Period=2&AutoPay=True&IncludeDataVolumes=false HTTP/1.1
Host: open.volcengineapi.com
Region: cn-beijing
Service: ecs

返回示例

{
    "ResponseMetadata": {
        "RequestId": "2021062415303301022514515207C4****",
        "Action": "ModifyInstanceChargeType",
        "Version": "2020-04-01",
        "Service": "ecs",
        "Region": "cn-beijing"
    },
    "Result": {
        "OrderId": "Order7021038849342******"
    }
}

错误码

HttpCode错误码错误信息描述
400MissingParameter.InstanceIdThe required parameter InstanceId is not supplied.实例ID不能为空。
400InvalidInstanceStatusThe status of the specified instance does not support this request.当前实例的状态不支持此操作。
400InvalidArgumentThe specified argument is invalid.指定的参数不合法。
400InvalidInstanceChargeTypeThe specified InstanceChargeType is invalid.指定的实例计费类型不合法。
400InvalidPeriodUnitThe specified PeriodUnit is not valid, is unsupported, or cannot be used.指定的计费周期不合法。
400InvalidPeriodThe specified period is not valid.指定的计费周期个数不合法。
400LimitExceeded.MaximumInstanceIdsYou've reached the limit on the number of InstanceIds that you can set.指定的InstanceIds数量超过最大限制。
400Insufficient.BalanceThe request is denied due to the lack of balance.账户余额不足。
400InvalidClientToken.MalformedThe specified ClientToken is malformed.指定的ClientToken不合法。
400IdempotentParameterMismatchThe 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.幂等参数不一致。
400QuotaExceeded.MaximumInstanceCpusYou've reached the limit on the number of instance CPU that you can create, please submit ticket to request an increase in quota.实例CPU数量配额不足,请提工单申请提高配额。
400QuotaExceeded.MaximumInstanceTypeInstancesYou've reached the limit on the number of instance type instances that you can create, please submit ticket to request an increase in quota.规格实例数量配额不足,请提工单申请提高配额。
400QuotaExceeded.MaximumInstancesYou've reached the limit on the number of instances that you can create, please submit ticket to request an increase in quota.实例数量配额不足,请提工单申请提高配额。
400InvalidSpotStrategyForModifyInstanceChargeType.UnsupportedThe specified SpotStrategy cannot be used to modify instance charge type.指定的实例抢占策略不支持更改计费类型。
400InvalidScheduledInstanceForModifyInstanceChargeType.UnsupportedThe specified scheduled instance cannot be used to modify instance charge type.指定的弹性预约实例不支持更改计费类型。
404InvalidInstance.NotFoundThe specified instance does not exist.指定的实例不存在。
412IdempotentProcessingThe request uses the same client token as a previous one that is still in process.先前的幂等请求仍在处理中,请稍后重试。
412InvalidInstance.ExpiredThe specified instance has expired.实例已过期。
412OperationDenied.ResourceLockedThe specified operation is denied as your resource is locked for another operation.指定的操作被拒绝,因为您的资源已被其他操作锁定。
412OperationDenied.ResourceCreatedByOtherServiceThe specified operation is denied as your resource is created by other service. You can check system tags to find the service.指定的操作被拒绝,因为您的资源被其他服务创建。您可以通过资源的系统标签查询对应服务。
500Insufficient.InstanceCapacityThere is not enough capacity to fulfill your request.当前资源不足,请稍后重试或选择其它实例规格。
500InternalErrorAn internal error has occurred.内部错误,请重试。如果多次尝试失败,请提交工单。