全部產品
Search
文件中心

Elastic Compute Service:ModifyInstanceNetworkSpec

更新時間:Sep 02, 2026

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

介面說明

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

  • 修改按量付費(PostPaid)執行個體的頻寬配置時,公網出頻寬(InternetMaxBandwidthOut)從 0 Mbit/s 升級到一個非零值時不會自動分配公網 IP。您需要指定參數 AllocatePublicIp 為 true 以分配公網 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. 指定的 InternetMaxBandwidthIn 參數超出最大限值。
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. 指定的 VPC 執行個體已經綁定 EIP。
400 InvalidClientToken.ValueNotSupported The ClientToken provided is invalid. 指定的 ClientToken 不合法。
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. 公網 IP 地址分配失敗。
400 InvalidParam.AllocatePublicIp The specified param AllocatePublicIp is invalid. 指定的 AllocatePublicIp 無效。
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. 指定的開始時間 StartTime 大於資源的過期時間。
400 InvalidEndTime.BeyondLifeCycle The specified end time exceeds the expiration time. 結束時間參數(EndTime)超出了資源的生命週期。
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. 該操作需要價格權限。請向您的主帳戶申請權限,或將參數 AutoPay 設定為 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. 目前執行個體狀態不支援修改 CPU 拓撲類型。
400 QuotaExceeded.InternetBandwidth %s. 您目前帳號下,隨用隨付 ECS 執行個體的按固定頻寬計費公網頻寬超過了總頻寬配額限制。
400 UnsupportedIspNetworkChargeType The network charge type is not supported when specifying ISP. 此執行個體的網路計費類型不支援指定 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. EIP 操作過於頻繁。
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. VPC 類型執行個體綁定 EIP 後不需要指定公網頻寬。
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. 已綁定 EIP 的執行個體不支援此操作,請先解除綁定此 EIP。
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. 指定的執行個體 ID 已存在未支付訂單,您可以登入 ECS 管理主控台支付。
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 marketplace image is not authorized. Please verify the marketplace image authorization and try again.
403 InvalidInstanceChargeType.ValueNotSupported The specified parameter ChargeType is not valid. 指定的執行個體計費方式不存在。
403 InvalidIspType.ValueNotSupported %s
403 UnsupportedIspChargeType %s 您指定的付費類型不支援 Isp 參數。
403 UnsupportedIspClassicNetwork %s
403 InvalidIspBandwidthOut %s
403 UnsupportedChangeIsp %s
403 InvalidIspUID %s
403 UnsupportedIspRegion %s
403 BandIncreaseNotSupportIsp %s ISP 執行個體不支援臨時頻寬升級。
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. 在指定的地域或付費類型條件下,執行個體公網 IP 地址庫存不足。請嘗試使用其它地域或付費類型。
403 InvalidOperation.NetworkTypeUnsupported The specified network type is not supported in this region. 該指定網路類型在本地區不支援。
404 InvalidInstanceId.NotFound The specified InstanceId does not exist. 指定的執行個體不存在,請您檢查執行個體 ID 是否正確。
409 OperationConflict Request was denied due to conflict with a previous request,please try again later. 請求衝突,稍等一段時間重試,或者提交工單回饋。

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

變更歷史

更多資訊,參考變更詳情。