文档

ModifyInstanceSpec - 调整实例的实例规格和公网带宽

更新时间:

调用ModifyInstanceSpec调整一台按量付费ECS实例的实例规格和公网带宽大小。

接口说明

请确保在使用该接口前,您已充分了解云服务器 ECS的计费方式和产品定价。

更多有关资源变配的 Python SDK 示例信息,请参见查询可用的变配资源

调用该接口时,您需要注意:

  • 账号必须处于无欠费状态。
  • 实例状态必须为运行中Running)或者已停止Stopped)时才能调节公网带宽大小。
  • 升级或者降低按量付费实例规格前,您可以通过 DescribeResourcesModification 查询当前实例支持变配的实例规格。
  • 实例状态必须为已停止Stopped)时才能变更实例规格。
  • 单次只能升级单项配置,即单次只能修改实例规格,或者只能调整公网带宽大小。
  • 自 2020 年 11 月 27 日起,创建和变配 ECS 实例时带宽峰值受账户限速策略影响。如需更大带宽峰值,请提交工单。具体限速策略如下:
    • 单个地域下,所有按使用流量计费 ECS 实例的实际运行带宽峰值总和不大于 5 Gbit/s。
    • 单个地域下,所有按固定带宽计费 ECS 实例的实际运行带宽峰值总和不大于 50 Gbit/s。

调试

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

授权信息

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

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

请求参数

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

指定的实例 ID。

i-bp67acfmxazb4p****
InstanceTypestring

实例的目标规格。更多信息,请参见实例规格族,也可以调用 DescribeInstanceTypes 接口获得最新的规格表。

ecs.g6.large
InternetMaxBandwidthOutinteger

公网出带宽最大值,单位为 Mbit/s(Megabit per second)。取值范围:0~100。

说明 按使用流量计费模式下的出入带宽峰值都是带宽上限,不作为业务承诺指标。当出现资源争抢时,带宽峰值可能会受到限制。如果您的业务需要有带宽的保障,请使用按固定带宽计费模式。
10
InternetMaxBandwidthIninteger

公网入带宽最大值,单位为 Mbit/s(Megabit per second)。取值范围:

  • 当所购公网出带宽小于等于 10 Mbit/s 时:1~10,默认为 10。
  • 当所购公网出带宽大于 10 Mbit/s 时:1~InternetMaxBandwidthOut的取值,默认为InternetMaxBandwidthOut的取值。
说明 按使用流量计费模式下的出入带宽峰值都是带宽上限,不作为业务承诺指标。当出现资源争抢时,带宽峰值可能会受到限制。如果您的业务需要有带宽的保障,请使用按固定带宽计费模式。
10
Temporary.StartTimestring
说明 该参数正在邀测中,暂未开放使用。
null
Temporary.EndTimestring
说明 该参数正在邀测中,暂未开放使用。
null
Temporary.InternetMaxBandwidthOutinteger
说明 该参数正在邀测中,暂未开放使用。
null
Asyncboolean

是否提交异步请求。取值范围:

  • true:是。
  • false:否。

默认值:false。

false
AllowMigrateAcrossZoneboolean

是否支持跨集群升级实例规格。

  • true:是。
  • false:否。

默认值:false

当参数AllowMigrateAcrossZone取值为 true 时,一旦您根据返回信息升级了云服务器,请留意以下注意事项:

经典网络类型实例:

  • 对于已停售的实例规格,非 I/O 优化实例变配到 I/O 优化实例时,实例私网 IP 地址、磁盘设备名和软件授权码会发生变化。对于 Linux 实例,普通云盘(cloud)会被识别为 xvda 或者 xvdb 等,高效云盘(cloud_efficiency)和 SSD 云盘(cloud_ssd)会被识别为 vda 或者 vdb 等。

  • 对于正常售卖的实例规格族,实例的私网 IP 地址会发生变化。

专有网络 VPC 类型实例:对于已停售的实例规格,非 I/O 优化实例变配到 I/O 优化实例时,云服务器磁盘设备名和软件授权码会发生变化。Linux 实例的普通云盘(cloud)会被识别为 xvda 或者 xvdb 等,高效云盘(cloud_efficiency)和 SSD 云盘(cloud_ssd)会被识别为 vda 或者 vdb 等。

false
SystemDisk.Categorystring

更换系统盘类型。取值范围:

  • cloud_efficiency:高效云盘

  • cloud_ssd:SSD 云盘

说明 该参数只有在从已停售的实例规格升级到正常售卖的实例规格族,并将非 I/O 优化实例规格升级为 I/O 优化实例规格时有效。
cloud_ssd
ClientTokenstring

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

0c593ea1-3bea-11e9-b96b-88e9fe637760
ModifyModestring
说明 该参数暂未开放使用。
null
Diskobject []
说明 该参数暂未开放使用。
DiskIdstring
说明 该参数暂未开放使用。
null
Categorystring
说明 该参数暂未开放使用。
null
PerformanceLevelstring
说明 该参数暂未开放使用。
null
DryRunboolean

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

  • true:发送检查请求,不会调整实例的实例规格和公网带宽大小。检查项包括是否填写了必需参数、请求格式、业务限制和 ECS 库存。如果检查不通过,则返回对应错误。如果检查通过,则返回错误码DryRunOperation
  • false(默认):发送正常请求,通过检查后直接调整实例的实例规格和公网带宽大小。
false

返回参数

名称类型描述示例值
object
RequestIdstring

请求 ID。

473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

示例

正常返回示例

JSON格式

{
  "RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E"
}

错误码

HTTP status code错误码错误信息描述
400InvalidInternetChargeType.ValueNotSupportedThe specified InternetChargeType is not valid.暂不支持指定的网络付费类型的实例,请确认相关参数是否正确。
400InvalidInstanceType.ValueUnauthorizedThe specified InstanceType does not exist or beyond the permitted range.您指定的实例规格不存在,或者您没有权限操作此规格的实例。
400InvalidInstanceType.ValueUnauthorizedThe specified InstanceType is not authorized.指定的实例规格未授权使用。
400InvalidInstanceType.ValueNotSupportedThe specified InstanceType does not exist or beyond the permitted range.您指定的实例规格不存在,或者您没有权限操作此规格的实例。
400InvalidParameterThe specified parameter "InternetMaxBandwidthOut" is not valid.-
400InvalidParameter.MismatchToo many parameters in one request.请求中包含的参数过多。
400BandwidthUpgradeDenied.EipBoundInstanceThe specified VPC instance has bound EIP, temporary bandwidth upgrade is denied.该实例已经绑定 EIP,不能进行临时升级。
400InvalidTemporary.StartTimeThe specifed Temporary.StartTime is not valid.指定的临时升级开始时间无效。
400InvalidTemporary.EndTimeThe specifed Temporary.EndTime is not valid.指定的临时升级结束时间无效。
400Downgrade.NotSupportedDowngrade operation is not supported.不支持降配。
400DependencyViolation.InstanceTypeThe current InstanceType cannot be changed to the specified InstanceType.当前实例的规格不能变更到指定的规格。
400Account.ArrearageYour account has an outstanding payment.您的账号存在未支付的款项。
400InvalidParameter.BandwidthThe specified parameter Bandwidth is not valid.指定的 Bandwidth 不合法。
400InvalidParameter.ConflictThe specified image does not support the specified instance type.指定的镜像不能用于指定的实例规格。
400InvalidParameter.AllowMigrateAcrossZoneThe specified parameter CanMigrateAcrossZone is not valid.指定的参数 CanMigrateAcrossZone 无效。
400InvalidParam.SystemDiskCategoryThe specified param SystemDisk.Category is not valid.指定的系统盘类型参数无效。
400ThrottlingRequest was denied due to request throttling, please try again after 5 minutes.您当前的请求被流控,请5分钟后重试。
400InvalidInstanceStatus.NotStoppedThe specified Instance status is not stopped.指定实例的状态不是已停止。
400InvalidActionSpecified action is not valid.该操作无效。
400IdempotenceParamNotMatchThere is a idempotence signature mismatch between this and last request.该请求与上一个请求的 ClientToken 参数一致,但其它请求参数不一致。
400InvalidClientToken.ValueNotSupportedThe ClientToken provided is invalid.指定的 ClientToken 不合法。
400Price.PricePlanResultNotFoundThe internetMaxBandwidthIn or internetMaxBandwidthOut provided is invalid.提供的 internetMaxBandwidthIn 或 internetMaxBandwidthOut 无效。
400InvalidAction.NotSupportThe ecs on dedicatedHost not support modify instanceType.专用宿主机上的实例不支持变更实例规格。
400InvalidMarketImageStatus.NotSupportedThe status of specified market image does not support this operation.指定的市场镜像的状态不支持该操作。
400InvalidOperation.VpcHasEnabledAdvancedNetworkFeatureThe specified vpc has enabled advanced network feature.该VPC开启了高阶特性,不能创建低规格的ECS。
400Invalid.PrivatePoolOptions.MatchCriteriaTarget mode does not support this operation.Target模式不支持本次操作。
400InstanceTypeNotSupported.TooManyDisksAttached%s-
400InvalidDiskCategory.NotSupportedThe upgrade operation of instance does not support this category of disk.实例的升级操作不支持此类磁盘。
400InvalidParameter.CloudboxNotSupported%s-
400QuotaExceed.DiskCapacityThe used capacity of disk type has exceeded the quota in the zone, %s.指定磁盘类型的已用容量超出可用区配额限制,您可以前往配额中心查询和申请提升磁盘容量配额。
400InvalidParam.AsyncThe specified parameter async is not valid.Async参数不合法。
400MissingParameter.DiskCategoryThe specified parameter Disk.Category can not be null when Disk.DiskId is specified.-
400InvalidParameter.DiskCategoryThe specified parameter Disk.Category is not valid.-
400InvalidPerformanceLevel.MalformedThe specified parameter Disk.n.PerformanceLevel is not valid.-
400NoPermission.PriceThe operation requires price permission. Please either apply for permission from your main account, or set the parameter AutoPay as true.-
400InvalidParameter.DedicatedRegionNotSupportedThe specified action is rejected because the specified ECS instance in the dedicated region does not support public IP.专属云地域不支持的参数错误码
400InvalidOperation.OnlineModificationUnsupportedOnline modification of instance type is not supported for the specified instance due to its CPU topology.当前CPU拓扑类型不支持热变配
403CategoryViolationThe specified instance does not support this operation because of its disk category.挂载有本地磁盘的实例不支持升降配。
403InvalidStatus.ValueNotSupportedThe current status of the resource does not support this operation.当前资源的状态不支持此操作。
403InstanceLockedForSecurityThe specified operation is denied as your instance is locked for security reasons.实例被安全锁定。
403InvalidAccountStatus.NotEnoughBalanceYour account does not have enough balance.账号余额不足,请您先充值再进行该操作。
403ChargeTypeViolationThe operation is not permitted due to charge type of the instance.付费方式不支持该操作,请您检查实例的付费类型是否与该操作冲突。
403OperationDeniedThe specified instance is out of usage.指定的实例库存不足。
403LastTokenProcessingThe last token request is processing.正在处理上一条令牌请求,请您稍后再试。
403InvalidInstance.UnpaidOrderThe specified instance has unpaid order.指定的实例有未支付的订单,请您先支付再进行操作。
403InstanceSpecModification.NotEffectiveThe specified instance has been reserved for making a spec modification and not taken effective in the current contract period.指定的实例因规格调整被保留,在当前合同期内无法生效。
403InvalidInstanceType.ValueNotSupportedThe specified zone does not offer the specified instancetype.指定的区域不提供此类型的实例。
403ImageNotSupportInstanceTypeThe specified image do not support the InstanceType instance.指定的镜像不支持此类实例规格。
403InstanceType.OfflineThe specified InstanceType has been offline.-
403InvalidParameter.NotMatch%s您输入的参数无效,请检查参数之间是否冲突。
403InvalidInstance.EipNotSupportThe specified instance with eip is not supported, please unassociate eip first.已绑定 EIP 的实例不支持该操作,请先解绑此EIP。
403InvalidInstance.NatPortMapNotSupportThe special instance with nat port map not support operate, please remove nat port map first.-
403InvalidOperation.StarterPackageStarterPackage not support modification.-
403OperationDenied.NoStockThe resource is out of usage.该实例不在运行状态,请您启动实例或检查操作是否合理。
403OperationDenied.UnpaidOrderThe specified instance has unpaid order.指定的实例ID已存在未支付订单,您可以登录ECS管理控制台支付。
403OperationDenied%s拒绝操作。
403InvalidOperation.EipNotSupportThe special instance with eip not support operate, please unassociate eip first.-
403InvalidParameter.InternetMaxBandwidthOutThe specified parameter InternetMaxBandwidthOut is invalid.-
403InvalidOperation.EniCountExceeded%s-
403InvalidOperation.Ipv4CountExceeded%sIPv4 数量达到上限,导致该操作无效。
403InvalidOperation.Ipv6CountExceeded%sIPv6 数量达到上限,导致该操作无效。
403InvalidOperation.Ipv6NotSupport%sIPv6不支持当前操作。
403InvalidOperation.Ipv4NotSupport%s-
403InvalidOperation.InstanceWithEipNotSupportThe special instance with eip not support operate, please unassociate eip first.已绑定 EIP 的实例不支持该操作,请优先解绑 EIP。
403SecurityRisk.3DVerificationWe have detected a security risk with your default credit or debit card. Please proceed with verification via the link in your email.我们检测到您的默认信用卡或借记卡存在安全风险。请通过电子邮件中的链接进行验证。
403InvalidInstance.NotFoundSystemDiskThe specified instance has no system disk.指定的实例没有挂载系统盘。请确保指定的实例已挂载了系统盘。您可以调用 DescribeInstances 查询指定实例的信息。
403InvalidInstanceType.NotSupportDiskCategoryThe instanceType of the specified instance does not support this disk category.指定的实例规格(InstanceType)不支持当前实例的云盘类别。请尝试更换其它实例规格。关于实例规格支持的云盘类型,请参见实例规格族文档。
403QuotaExceed.ElasticQuotaNo additional quota is available for the specified ECS instance type.您在当前地域选择的实例规格所要创建的台数超出系统限额,您可以选择其他地域、实例规格或减少台数重新购买,也可以前往ECS管理控制台或配额中心申请提高限额。
403QuotaExceed.ElasticQuotaThe number of the specified ECS instances has exceeded the quota of the specified instance type.您在当前地域选择的实例规格所要创建的台数超出系统限额,您可以选择其他地域、实例规格或减少台数重新购买,也可以前往ECS管理控制台或配额中心申请提高限额。
403QuotaExceed.ElasticQuotaThe number of vCPUs assigned to the ECS instances has exceeded the quota in the zone.您的全实例规格vCPU配额超出系统限额,您可以前往ECS管理控制台或配额中心申请提高限额。
403QuotaExceed.ElasticQuotaThe number of the specified ECS instances has exceeded the quota of the specified instance type, or the number of vCPUs assigned to the ECS instances has exceeded the quota in the zone.您在当前地域选择的实例规格所要创建的台数超出系统限额,或者全实例规格vCPU配额超出系统限额,您可以前往ECS管理控制台或配额中心申请提高限额。
403InvalidResourceType.NotSupported%s-
403InvalidOperation.NotAllowedThe specified vpc %s has enabled senior network feature.-
403InvalidOperation.InstanceTypeNotSupportEniTrunking%s不支持本次操作。具体信息请参见错误信息%s占位符的实际返回值。
403InvalidOperation.MaxEniQueueNumberExceeded%s弹性网卡队列数超过上限,具体信息请参见错误信息%s占位符的实际返回结果。
403InvalidOperation.ExceedInstanceTypeQueueNumber%s弹性网卡队列总数超过上限,具体信息请参见错误信息%s占位符的实际返回结果。
403InvalidParameter.InvalidEniQueueNumber%s弹性网卡队列数有误,具体信息请参见错误信息%s占位符的实际返回结果。
403HibernationConfigured.InstanceOperationForbiddenThe operation is not permitted due to limit of the hibernation configured instance.不符合开启休眠选项的实例的相关限制,操作不被允许。
403InvalidOperation.InstanceTypeNotSupportHighPerformanceTrafficMode%s-
403InvalidOperation.EniQueuePairNumberOverflow%s-
403InvalidOperation.HighPerformanceEniPerInstanceLimitExceeded%s-
403InvalidOperation.MaxEniQueuePairNumberExceed%s-
403InvalidOperation.MaxModifyOnlineNumberExceededThe specified instance has reached the maximum number of modify online attempts and needs to be rebooted.-
403InvalidOperation.RebootingRequiredThe specified instance needs to be rebooted.-
403InvalidOperation.OSTypeNotSupportedThe specified OS type is not supported.-
403InvalidSystemDiskCategory.ValueNotSupportedThe specified parameter SystemDisk.Category is not valid.指定的 SystemDisk.Category 值不受支持。
404InvalidInstanceId.NotFoundThe specified InstanceId does not exist.指定的实例ID未找到。
404MissingTemporary.StartTimeTemporary.StartTime is not specified.未指定临时升级开始时间。
404MissingTemporary.EndTimeTemporary.EndTime is not specified.未指定临时升级结束时间。
404InvalidInstanceChargeType.NotFoundThe InstanceChargeType does not exist in our records.指定的实例计费方式不存在。
500InternalErrorThe request processing has failed due to some unknown error, exception or failure.内部错误,请重试。
500InternalErrorThe request processing has failed due to some unknown error.内部错误,请重试。

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

变更历史

变更时间变更内容概要操作
2024-02-01OpenAPI 错误码发生变更、OpenAPI 入参发生变更看变更集
变更项变更内容
错误码OpenAPI 错误码发生变更
    删除错误码:400
    删除错误码:403
    删除错误码:404
    删除错误码:500
入参OpenAPI 入参发生变更
    新增入参:DryRun
2023-12-14OpenAPI 错误码发生变更看变更集
变更项变更内容
错误码OpenAPI 错误码发生变更
    错误码 400 变更
    删除错误码:403
    删除错误码:404
    删除错误码:500
2023-10-10OpenAPI 错误码发生变更看变更集
变更项变更内容
错误码OpenAPI 错误码发生变更
    错误码 400 变更
    删除错误码:403
    删除错误码:404
    删除错误码:500
2023-08-30OpenAPI 错误码发生变更看变更集
变更项变更内容
错误码OpenAPI 错误码发生变更
    错误码 403 变更
    删除错误码:400
    删除错误码:404
    删除错误码:500
2023-05-08OpenAPI 错误码发生变更看变更集
变更项变更内容
错误码OpenAPI 错误码发生变更
    错误码 400 变更
    删除错误码:403
    删除错误码:404
    删除错误码:500
2023-04-07OpenAPI 错误码发生变更、OpenAPI 入参发生变更看变更集
变更项变更内容
错误码OpenAPI 错误码发生变更
    错误码 400 变更
    错误码 403 变更
    删除错误码:404
    删除错误码:500
入参OpenAPI 入参发生变更
    新增入参:ModifyMode
  • 本页导读 (1)
文档反馈