全部產品
Search
文件中心

Elastic Compute Service:ModifyInstanceNetworkSpec

更新時間:Jun 24, 2026

修改 ECS 執行個體的頻寬配置、分配公網 IP、轉換網路計費方式,支援升配和降配。

介面說明

  • 修改包年包月(PrePaid)執行個體的頻寬配置時,公網出頻寬(InternetMaxBandwidthOut)從 0 Mbit/s 升級到一個非零值時會自動分配一個公網 IP。

  • 修改隨用隨付(PostPaid)執行個體的頻寬配置時,公網出頻寬(InternetMaxBandwidthOut)從 0 Mbit/s 升級到一個非零值時不會自動分配公網 IP。您需要指定參數AllocatePublicIptrue分配公網 IP。

說明

單個地域下,單個阿里雲帳號按固定頻寬計費的公網頻寬峰值總和存在限制,請參見公網頻寬限制

  • 費用:

    • 升級頻寬後,預設自動扣費。您需要確保支付方式餘額充足,否則會產生異常訂單,此時只能作廢訂單。如果您的帳戶餘額不足,可以將參數 AutoPay 置為 false,此時會產生正常的未支付訂單,您可以登入 ECS 管理控制台支付。

    • 降低頻寬後,價格差退款將原路退還,已使用的代金券不退回。

調試

您可以在OpenAPI Explorer中直接運行該介面,免去您計算簽名的困擾。運行成功後,OpenAPI Explorer可以自動產生SDK程式碼範例。

調試

授權資訊

下表是API對應的授權資訊,可以在RAM權限原則語句的Action元素中使用,用來給RAM使用者或RAM角色授予調用此API的許可權。具體說明如下:

  • 操作:是指具體的許可權點。

  • 存取層級:是指每個操作的存取層級,取值為寫入(Write)、讀取(Read)或列出(List)。

  • 資源類型:是指操作中支援授權的資源類型。具體說明如下:

    • 對於必選的資源類型,用前面加 * 表示。

    • 對於不支援資源級授權的操作,用全部資源表示。

  • 條件關鍵字:是指雲產品自身定義的條件關鍵字。

  • 關聯操作:是指成功執行操作所需要的其他許可權。操作者必須同時具備關聯操作的許可權,操作才能成功。

操作

存取層級

資源類型

條件關鍵字

關聯操作

ecs:ModifyInstanceNetworkSpec

update

*Instance

acs:ecs:{#regionId}:{#accountId}:instance/{#instanceId}

  • ecs:AssociatePublicIpAddress

請求參數

名稱

類型

必填

描述

樣本值

InstanceId

string

待修改網路配置的執行個體 ID。

i-bp67acfmxazb4****

InternetMaxBandwidthOut

integer

公網出頻寬最大值,單位:Mbit/s(Megabit per second)。取值範圍:

  • 按使用流量計費:0~100。

  • 按固定頻寬計費:

    • 包年包月執行個體:0~200。

    • 隨用隨付執行個體:0~100。

說明

單執行個體出頻寬峰值也會受到 ECS 執行個體規格的 網路頻寬基礎/突發(Gbit/s) 指標資料限制。更多資訊,請參見執行個體規格族

10

InternetMaxBandwidthIn

integer

公網入頻寬最大值,單位:Mbit/s(Megabit per second)。取值範圍:

  • 當所購公網出頻寬小於等於 10 Mbit/s 時:1~10,預設為 10。

  • 當所購公網出頻寬大於 10 Mbit/s 時:1~InternetMaxBandwidthOut的取值,預設為InternetMaxBandwidthOut的取值。

10

ISP

string

說明

該參數正在邀測中,暫未開放使用。

null

NetworkChargeType

string

轉換網路計費方式。取值範圍:

  • PayByBandwidth:按固定頻寬計費。

  • PayByTraffic:按使用流量計費。

說明

按使用流量計費模式下的出入頻寬峰值都是頻寬上限,不作為業務承諾指標。當出現資源爭搶時,頻寬峰值可能會受到限制。如果您的業務需要有頻寬的保障,請使用按固定頻寬計費模式。

PayByTraffic

AllocatePublicIp

boolean

是否分配公網 IP 位址。

  • true:分配。

  • false:不分配。

預設值:false。

false

StartTime

string

臨時頻寬升級開始時間。按照ISO 8601標準表示,並使用 UTC+0 時間,格式為 yyyy-MM-ddTHH:mmZ。精確到分鐘(mm)。

2017-12-05T22:40Z

EndTime

string

臨時頻寬升級結束時間。按照ISO 8601標準表示,並使用 UTC+0 時間,格式為 yyyy-MM-ddTHHZ。精確到小時(HH)。

說明

臨時升級頻寬的結束時間和開始時間的間隔必須大於或等於 3 小時。

2017-12-06T22Z

AutoPay

boolean

是否自動支付。取值範圍:

  • true:變更頻寬配置後,自動扣費。當您將參數 Autopay 置為 true 時,您需要確保帳戶餘額充足,如果帳戶餘額不足會產生異常訂單,此訂單暫時不支援透過 ECS 控制台支付,只能作廢。

  • false:變更頻寬配置後,只產生訂單不扣費。如果您的支付方式餘額不足,可以將參數 Autopay 置為 false,即取消自動支付,此時呼叫該介面會產生正常的未支付訂單,此訂單可登入ECS 管理控制台支付。

預設值:true。

true

ClientToken

string

保證請求冪等性。從您的用戶端產生一個參數值,確保不同請求間該參數值唯一。ClientToken 只支援 ASCII 字元,且不能超過 64 個字元。更多資訊,請參見如何保證冪等性

123e4567-e89b-12d3-a456-426655440000

返回參數

名稱

類型

描述

樣本值

object

OrderId

string

訂單 ID。僅在修改包年包月(PrePaid)執行個體的頻寬配置時返回。

123457890

RequestId

string

請求 ID。

473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

樣本

正常返回樣本

JSON格式

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

錯誤碼

HTTP status code

錯誤碼

錯誤資訊

描述

400 InvalidInternetMaxBandwidthIn.ValueNotSupported The specified InternetMaxBandwidthIn is beyond the permitted range.
400 InvalidInternetMaxBandwidthOut.ValueNotSupported The specified InternetMaxBandwidthOut is beyond the permitted range.
400 OperationDenied Specified instance is in VPC.
400 InvalidParameter.Conflict %s
400 InvalidStartTime.ValueNotSupported The specified StartTime is out of the permitted range.
400 InvalidEndTime.ValueNotSupported The specified EndTime is out of the permitted range.
400 ChargeTypeViolation The operation is not permitted due to billing method of the instance.
400 Account.Arrearage Your account has an outstanding payment.
400 InvalidInternetChargeType.ValueNotSupported The specified InternetChargeType is invalid.
400 DecreasedBandwidthNotAllowed %s
400 BandwidthUpgradeDenied.EipBoundInstance The specified VPC instance has bound EIP, temporary bandwidth upgrade is denied.
400 InvalidClientToken.ValueNotSupported The ClientToken provided is invalid.
400 Throttling Request was denied due to request throttling, please try again after 5 minutes.
400 InvalidInstanceStatus.NotStopped The specified Instance status is not Stopped.
400 InvalidAction Specified action is not valid.
400 IpAllocationError Allocate public ip failed.
400 InvalidParam.AllocatePublicIp The specified param AllocatePublicIp is invalid.
400 InstanceDowngrade.QuotaExceed Quota of instance downgrade is exceed.
400 InvalidBandwidth.ValueNotSupported Instance upgrade bandwidth of temporary not allow less then existed.
400 InvalidInstanceStatus The specified instance status does not support this action.
400 InvalidInstance.UnPaidOrder Unpaid order exists in your account, please complete or cancel the payment in the expense center.
400 LastOrderProcessing The previous order is still processing, please try again later.
400 LastRequestProcessing The previous request is still processing, please try again later.
400 InvalidStartTime.BeyondLifeCycle The specified start time exceeds the expiration time.
400 InvalidEndTime.BeyondLifeCycle The specified end time exceeds the expiration time.
400 InvalidPayMethod.SyncPaymentNotSupport Synchronous payment is not supported. Use another payment method.
400 InvalidBandwidthOut.LessThanZero The bandwidth must be larger than 0 when specifying isp.
400 InvalidParameter.BandwidthBiggerThanBaseBandwidth %s
400 InvalidAction.WithActiveElasticUpgrade The instance has active Elastic Upgrade.
400 InvalidParameter.CloudboxNotSupported %s
400 InvalidParameter.Bandwidth %s
400 NoPermission.Price The operation requires price permission. Please either apply for permission from your main account, or set the parameter AutoPay as true.
400 NoPermission.Refund The operation requires refund permission. Please apply for permission from your main account.
400 InvalidParameter.DedicatedRegionNotSupported The specified action is rejected because the specified ECS instance in the dedicated region does not support public IP.
400 InvalidOperation.InstanceStatusUnsupported The specified instance status is not supported for this operation, expect status is Running or Stopped.
400 QuotaExceeded.InternetBandwidth %s.
400 UnsupportedIspNetworkChargeType The network charge type is not supported when specifying ISP.
400 IncorrectInstanceStatus Current instance status does not support this operation.
400 TaskConflict The operation is too frequent, please wait a moment and try again.
400 InvalidOperation.InternetMaxBandwidthOutUnsupported The InternetMaxBandwidthOut is not allowed to modify.
500 InternalError The request processing has failed due to some unknown error.
500 Image.OrderFailed Create marketplace image order failed.
403 IncorrectInstanceStatus The current status of the instance does not support this operation.
403 InstanceLockedForSecurity The specified operation is denied as your instance is locked for security reasons.
403 InstanceExpiredOrInArrears The specified operation is denied as your prepay instance is expired (prepay mode) or in arrears (afterpay mode).
403 ChargeTypeViolation The operation is not permitted due to billing method of the instance.
403 OperationDenied The operation is denied due to the instance is PrePaid.
403 InvalidAccountStatus.NotEnoughBalance Your account does not have enough balance.
403 InvalidInstance.UnPaidOrder The specified Instance has unpaid order.
403 Throttling Request was denied due to request throttling, please try again after 5 minutes.
403 InvalidInstance.InstanceNotSupported The special vpc instance with eip not need bandwidth.
403 InstanceDowngrade.QuotaExceed Quota of instance downgrade is exceed.
403 InvalidInstanceStatus The current status of the instance does not support this operation.
403 InvalidOperation.StarterPackage StarterPackage not support modification.
403 NAT_PUBLIC_IP_BINDING_FAILED Binding nat public ip failed.
403 InvalidInstance.EipNotSupport The specified instance with eip is not supported, please unassociate eip first.
403 InvalidInstance.NatPortMapNotSupport The special instance with nat port map not support operate, please remove nat port map first.
403 OperationDenied.UnpaidOrder The specified instance has unpaid order.
403 Mayi.InternalError The request processing has failed due to some unknown error.
403 InvalidNetworkType.ValueNotSupported The specified parameter NetworkType is not valid.
403 OperationDenied.ImageNotValid The specified image is not authorized.
403 InvalidInstanceChargeType.ValueNotSupported The specified parameter ChargeType is not valid.
403 InvalidIspType.ValueNotSupported %s
403 UnsupportedIspChargeType %s
403 UnsupportedIspClassicNetwork %s
403 InvalidIspBandwidthOut %s
403 UnsupportedChangeIsp %s
403 InvalidIspUID %s
403 UnsupportedIspRegion %s
403 BandIncreaseNotSupportIsp %s
403 SecurityRisk.3DVerification We have detected a security risk with your default credit or debit card. Please proceed with verification via the link in your email.
403 InvalidOperation.PublicIpAddressNoStock The public IP address for the specified Region or ChargeType of the instance is out of stock. Please try another Region or ChargeType.
403 InvalidOperation.NetworkTypeUnsupported The specified network type is not supported in this region.
404 InvalidInstanceId.NotFound The specified InstanceId does not exist.
409 OperationConflict Request was denied due to conflict with a previous request,please try again later.

訪問錯誤中心查看更多錯誤碼。

變更歷史

更多資訊,參考變更詳情