全部产品
Search
文档中心

云服务器 ECS:ModifyDiskChargeType - 修改实例上云盘计费方式

更新时间:Mar 19, 2024

转换一台包年包月ECS实例上所挂载的数据盘的计费方式。

接口说明

更换计费方式后,默认自动扣费。您需要确保账户余额充足,否则会生成异常订单,此时只能作废订单。如果您的账户余额不足,可以将参数 AutoPay 置为 false,此时会生成正常的未支付订单,您可以登录用户中心后,在订单管理页面支付。

使用该接口时,请注意:

  • 按量付费实例仅支持挂载按量付费云盘,不支持修改挂载云盘的计费方式。
  • 挂载的实例不能为到期停机状态。
  • 更换计费方式前后的价格差退款会退还到您的原付费方式中,已使用的代金券不退回。
  • 每块云盘成功修改计费方式一次,五分钟内不能再次修改。

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

授权信息

下表是API对应的授权信息,可以在RAM权限策略语句的Action元素中使用,用来给RAM用户或RAM角色授予调用此API的权限。具体说明如下:

  • 操作:是指具体的权限点。
  • 访问级别:是指每个操作的访问级别,取值为写入(Write)、读取(Read)或列出(List)。
  • 资源类型:是指操作中支持授权的资源类型。具体说明如下:
    • 对于必选的资源类型,用背景高亮的方式表示。
    • 对于不支持资源级授权的操作,用全部资源表示。
  • 条件关键字:是指云产品自身定义的条件关键字。
  • 关联操作:是指成功执行操作所需要的其他权限。操作者必须同时具备关联操作的权限,操作才能成功。
操作访问级别资源类型条件关键字关联操作
ecs:ModifyDiskChargeTypeWrite
  • Instance
    acs:ecs:{#regionId}:{#accountId}:instance/{#instanceId}
  • ecs:tag

请求参数

名称类型必填描述示例值
InstanceIdstring

云盘挂载的实例 ID。

i-bp1i778bq705cvx1****
RegionIdstring

实例所属的地域 ID。您可以调用 DescribeRegions 查看最新的阿里云地域列表。

cn-hangzhou
DiskIdsstring

云盘 ID 列表,一个带有格式的 JSON Array,最多支持 16 个 ID,用半角逗号(,)隔开。

["d-bp67acfmxazb4ph****", "d-bp67acfmxazb4pi****", … "d-bp67acfmxazb4pj****"]
AutoPayboolean

是否自动支付。取值范围:

  • true(默认):自动支付。您需要确保账户余额充足,如果账户余额不足会生成异常订单,只能作废订单。
  • false:只生成订单不扣费。如果您的账户余额不足,会生成正常的未支付订单,此订单可登录用户中心后,在订单管理页面支付。
true
ClientTokenstring

保证请求幂等性。从您的客户端生成一个参数值,确保不同请求间该参数值唯一。ClientToken 只支持 ASCII 字符,且不能超过 64 个字符。更多信息,请参见如何保证幂等性

123e4567-e89b-12d3-a456-426655440000
DiskChargeTypestring

云盘计费方式。取值范围:

  • PrePaid(默认):按量付费数据盘转换为包年包月数据盘。
  • PostPaid:包年包月数据盘转换为按量付费数据盘。
PostPaid

返回参数

名称类型描述示例值
object
OrderIdstring

生成的订单 ID。

123456****
RequestIdstring

请求 ID。

473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

示例

正常返回示例

JSON格式

{
  "OrderId": "123456****",
  "RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E"
}

错误码

HTTP status code错误码错误信息描述
400InvalidInstanceType.ValueUnauthorizedThe specified InstanceType is not authorized.指定的实例规格未授权使用。
400InvalidInstanceType.ValueNotSupportedThe specified InstanceType is not supported.当前不支持您指定的实例规格,请选择其它实例规格。
400MissingParameter.RegionIdRegionId should not be null.参数 RegionId 不得为空。
400MissingParameter.InstanceIdNotSupportedInstanceId should not be null.参数 InstanceId 不能为空。
400ChargeTypeViolationThe operation is not permitted due to charge type of the instance.付费方式不支持该操作,请您检查实例的付费类型是否与该操作冲突。
400InvalidInstanceId.ReleasedThe specified Instance is not exist.指定的实例不存在,请您检查实例 ID 是否正确。
400InvalidInstance.PurchaseNotFoundThe specified Instance has no purchase.指定的实例无法购买。
400InvalidInstance.UnPaidOrderThe specified Instance has unpaid order.指定的实例有未支付的订单,请您先支付再进行操作。
400InvalidClientToken.ValueNotSupportedThe ClientToken provided is invalid.指定的 ClientToken 不合法。
400Account.ArrearageYour account has been in arrears.账户余额不足,请先充值再操作。
400Idempotence.SignatureMismatchThere is a idempotence signature mismatch between this and last request.作为和上一个幂等参数相同的请求,其他参数也必须完全相匹配。
400InvalidInstanceType.ValueUnauthorizedThe specified InstanceType is not Supported.您没有操作此实例规格的权限。
400OrderCreationFailedCreate Order failed, please check your parameters and try it later.创建订单失败,请检查您的参数,然后再试。
400ThrottlingRequest was denied due to request throttling, please try again after 5 minutes.您当前的请求被流控,请5分钟后重试。
400InstanceDowngrade.QuotaExceedQuota of instance downgrade is exceed.您的实例降配已超额度,无法进行此操作。
400ChargeTypeViolationThe operation is not permitted due to charge type of the disk.-
400InvalidInstanceId.NotFoundThe specified InstanceId does not exist.指定的实例ID未找到。
400InvalidDisk.DetachedSystemDiskThe specified disk is a detached system disk, does not support this operation.-
400LastOrderProcessingThe previous order is still processing, please try again later.订单正在处理中,稍后重试。
400InvalidAction.WithActiveElasticUpgradeThe instance has active Elastic Upgrade.指定的实例为临时升级中(即调用ModifyPrepayInstanceSpec时设置了EndTime参数)的实例,暂不支持查询。
400DISK_IN_DEDICATED_BLOCK_STORAGE_CLUSTERThe disk in dedicated block storage cluster is not allowed to do this operation.-
400NoPermission.PriceThe operation requires price permission. Please either apply for permission from your main account, or set the parameter AutoPay as true.-
400NoPermission.RefundThe operation requires refund permission. Please apply for permission from your main account.-
403Forbidden%s您未被授权使用指定的资源。
403InvalidAccountStatus.NotEnoughBalanceYour account does not have enough balance.账号余额不足,请您先充值再进行该操作。
403InvalidInstanceChargeType.NotFoundThe chargeType of the instance does not support this operation.该付费类型的实例不支持该操作。
403InvalidOperation.MultiAttachDiskMulti attach disk does not support this operation.开启多重挂载特性的云盘不支持该操作。
404InvalidRegionId.NotFoundThe RegionId provided does not exist.指定的地域不存在,请确认该参数是否正确。
404PaymentMethodNotFoundNo billing method has been registered on the account.您未注册任何计费方式,请注册后重试。
404InvalidZoneId.NotFoundThe ZoneId provided does not exist in our records.指定的可用区 ID 不存在。
404InvalidRamRole.NotFoundThe specified parameter "RAMRoleName" does not exist.-
404InvalidDiskIds.NotFoundSome of the specified data disks do not exist.参数 DiskIds 中的一些数据盘,不存在。
404InvalidDiskIds.NotPortableThe specified DiskId is not portable.指定的磁盘是不可移植的。
404InvalidDataDiskSize.ValueNotSupportedThe specified parameter "Size" is not supported.-
404InvalidAction.NotSupportedThe specified action is not supported.不支持指定的 API 操作。
404InvalidInstanceStatus.NotSupportedThe status of the specified instance is invalid.当前实例的状态不支持此操作。
404InvalidInstanceId.NOT_FOUNDThe specified instance is not exist.指定的实例不存在。
404InvalidDiskIds.NotPortableThe specified disk is not portable.-
500InternalErrorThe request processing has failed due to some unknown error.内部错误,请重试。

访问错误中心查看更多错误码。

变更历史

变更时间变更内容概要操作
暂无变更历史