全部產品
Search
文件中心

Virtual Private Cloud:AssociateHaVip

更新時間:Jun 19, 2026

呼叫 AssociateHaVip 介面將 HaVip 繫結到專有網路 ECS 執行個體或彈性網卡上。

介面說明

在呼叫本介面繫結 HaVip 時,請注意:

  • HaVip 繫結後立即生效,無需重新啟動 ECS 執行個體,但需要將 HaVip 設定到 ECS 執行個體的彈性網卡上。

  • HaVip 和要繫結的 ECS 執行個體必須同屬於一個交換機。

  • 一個 HaVip 支援同時繫結 10 個 ECS 執行個體或同時繫結 10 個彈性網卡,但一個 HaVip 不能同時繫結 ECS 執行個體和彈性網卡。

  • 要繫結的 ECS 執行個體的狀態必須為運行中停止

  • HaVip 執行個體的狀態必須為 AvailableInUse

  • AssociateHaVip 介面屬於非同步介面,即系統返回一個請求 ID,但該 HaVip 並未繫結完成,系統後台的繫結任務仍在進行。您可以呼叫 DescribeHaVips 查詢 HaVip 的繫結狀態:

    • 當 HaVip 處於 Associating 狀態時,表示 HaVip 正在繫結中。

    • 當 HaVip 處於 InUse 狀態時,表示 HaVip 繫結完成。

  • AssociateHaVip 介面不支援並行繫結同一個 HaVip。

調試

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

調試

授權資訊

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

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

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

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

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

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

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

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

操作

存取層級

資源類型

條件關鍵字

關聯操作

vpc:AssociateHaVip

create

*Instance

acs:vpc:{#regionId}:{#accountId}:instance/{#InstanceId}

*HaVip

acs:vpc:{#regionId}:{#accountId}:havip/{#HaVipId}

請求參數

名稱

類型

必填

描述

樣本值

ClientToken

string

用戶端 Token,用於保證請求的冪等性。

從您的用戶端產生一個參數值,確保不同請求間該參數值唯一。ClientToken 只支援 ASCII 字元。

說明

若您未指定,則系統自動使用 API 請求的 RequestId 作為 ClientToken 標識。每次 API 請求的 RequestId 可能不一樣。

0c593ea1-3bea-11e9-b96b-88e9fe63****

RegionId

string

HaVip 所在的地域 ID。

您可以透過呼叫 DescribeRegions 介面取得地域 ID。

cn-shanghai

HaVipId

string

要繫結的 HaVip 的 ID。

havip-2zeo05qre24nhrqpy****

InstanceId

string

與 HaVip 繫結的 ECS 執行個體 ID。

i-faf344422ffsfad****

InstanceType

string

要繫結 HaVip 的執行個體類型,取值:

  • EcsInstance:雲端伺服器 ECS 執行個體。

  • NetworkInterface:彈性網卡執行個體,當繫結 HaVip 的執行個體為彈性網卡,該參數必須填寫。

EcsInstance

返回參數

名稱

類型

描述

樣本值

object

RequestId

string

請求 ID。

C44F62BE-9CE7-4277-B117-69243F3988BF

樣本

正常返回樣本

JSON格式

{
  "RequestId": "C44F62BE-9CE7-4277-B117-69243F3988BF"
}

錯誤碼

HTTP status code

錯誤碼

錯誤資訊

描述

400 OperationUnsupported.BindOnFreeNetworkInterface The network interface must be attached to an ECS instance.
400 OperationUnsupported.BindMultipleType You cannot bind HaVip to multiple instance types.
400 OperationUnsupported.BindOnMultipleVswitch The bound instance and HaVip must be on the same vSwitch.
400 InvalidVip.Status vip invalid status
400 IncorrectHaVipStatus HaVip can be operated by this action only when it's status is Available or InUse.
400 IncorrectInstanceStatus ECS instance can be operated by this action only when it?s status is Running or Stopped.
400 CountLimitExceed.HaVipOnInstance The amount of HaVip associated with the specified Instance reach its limits.
400 CountLimitExceeded.HaVipOnECSInstance The amount of Instance associated with the specified HaVip reach its limits.
400 OperationFailed.DistibuteLock Distibute lock fail.
400 InvalidNetworkInterfaceId.NotFound The network interface is not found.
400 OperationFailed.QueryNetworkInterfaceInfo Failed to query network interface information.
400 IllegalParam.InstanceType The specified instance type is invalid. Only ECS instances and network interface are allowed.
400 OperationUnsupported.BindOnSameEcs You cannot bind two network interfaces on the same ECS instance.
400 OperationUnsupported.HavipBindType You cannot bind HAVIP to network interface in the specified region.
400 InvalidInstance.NotExist InvalidInstance.NotExist : The specified Instance does not exist in the specified region. i-bp136w25mhx503ptilrh\r\nRequestId : A961CC27-D797-4E16-B1B3-19B9ECBA1495
400 OperationDenied.BindOnSameEcs The operation is not allowed because networkinterface bind on same instance.
400 Forbidden.HaVip No permissions to perform operations on HAVIPs. Please apply for privilege--vpc_privilege_allow_buy_havip_instance.
400 InvalidInstanceId.NotFound The specified Instance does not exist in the specified region.
400 ResourceNotFound.EcsInstance The specified resource of ECS instance is not found.
400 InvalidStatus.NotAllow Bind instance status invalid
400 InvalidHaVip.Exist haVip already bind exist.
400 InvalidRegionId.NotFound The RegionId provided does not exist in our records.
400 QuotaExceeded.HaVipBindInstance The amount of instance associated with the specified haVip reach its limits.
404 InvalidHaVipId.NotFound The specified HaVip does not exist in the specified region.
404 InvalidInstanceId.NotFound The specified Instance does not exist in the specified region.

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

變更歷史

更多資訊,參考變更詳情