All Products
Search
Document Center

:AssociateHaVip

最終更新日:Aug 25, 2023

Associates a high-availability virtual IP address (HAVIP) with an Elastic Compute Service (ECS) instance or an elastic network interface (ENI) in a virtual private cloud (VPC).

Usage notes

When you call this operation, take note of the following limits:

  • An HAVIP immediately takes effect after it is associated. You do not need to restart the ECS instance. However, you must associate the HAVIP with the ENI of the ECS instance.
  • The HAVIP and ECS instance must belong to the same vSwitch.
  • You can associate an HAVIP with at most two ECS instances.
  • The ECS instance must be in the Running or Stopped state.
  • The HAVIP must be in the Available or InUse state.
  • AssociateHaVip is an asynchronous operation. After a request is sent, the system returns a request ID and runs the task in the background. You can call the DescribeHaVips operation to query the status of the task:
    • If the HAVIP is in the Associating state, the HAVIP is being associated.
    • If the HAVIP is in the InUse state, the HAVIP is associated.
  • You cannot repeatedly call the AssociateHaVip operation within a specific time period.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes AssociateHaVip

The operation that you want to perform. Set the value to AssociateHaVip.

ClientToken String No 0c593ea1-3bea-11e9-b96b-88e9fe63****

The client token that is used to ensure the idempotence of the request.

You can use the client to generate the token, but you must make sure that the token is unique among different requests. The token can contain only ASCII characters.

Note If you do not specify this parameter, the system automatically uses the request ID as the client token. The request ID may be different for each request.
RegionId String Yes cn-shanghai

The ID of the region to which the HAVIP belongs.

You can call the DescribeRegions operation to query the most recent region list.

HaVipId String Yes havip-2zeo05qre24nhrqpy****

The ID of the HAVIP.

InstanceId String Yes i-faf344422ffsfad****

The ID of the ECS instance to be associated with the HAVIP.

InstanceType String No EcsInstance

The type of the instance to be associated with the HAVIP. Valid values:

  • EcsInstance: ECS instance
  • NetworkInterface: ENI. If you want to associate the HAVIP with an ENI, this parameter is required.

Response parameters

Parameter Type Example Description
RequestId String C44F62BE-9CE7-4277-B117-69243F3988BF

The request ID.

Examples

Sample requests

http(s)://[Endpoint]/?Action=AssociateHaVip
&ClientToken=0c593ea1-3bea-11e9-b96b-88e9fe63****
&RegionId=cn-shanghai
&HaVipId=havip-2zeo05qre24nhrqpy****
&InstanceId=i-faf344422ffsfad****
&InstanceType=EcsInstance
&Common request parameters

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<AssociateHaVipResponse>
    <RequestId>C44F62BE-9CE7-4277-B117-69243F3988BF</RequestId>
</AssociateHaVipResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

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

Error codes

HttpCode Error code Error message Description
400 OperationUnsupported.BindOnFreeNetworkInterface The network interface must be attached to an ECS instance. The ENI must be associated with the ECS instance.
400 OperationUnsupported.BindMultipleType You cannot bind HaVip to multiple instance types. You cannot associate the ECS instance and the ENI at the same time.
400 OperationUnsupported.BindOnMultipleVswitch The bound instance and HaVip must be on the same vSwitch. The instance to be associated and the HAVIP must belong to the same vSwitch.
400 CountLimitExceed.HaVipOnInstance The amount of HaVip associated with the specified Instance reach its limits. The number of HAVIPs has reached the upper limit.
400 CountLimitExceeded.HaVipOnECSInstance The amount of Instance associated with the specified HaVip reach its limits. The number of HAVIPs has reached the upper limit.
400 InvalidNetworkInterfaceId.NotFound The network interface is not found. The ENI does not exist.
400 OperationFailed.QueryNetworkInterfaceInfo Failed to query network interface information. The system failed to query ENI information.
400 IllegalParam.InstanceType The specified instance type is invalid. Only ECS instances and network interface are allowed. The type of the associated instance does not support this operation.
400 OperationUnsupported.BindOnSameEcs You cannot bind two network interfaces on the same ECS instance. You are not allowed to associate two ENIs of the same ECS instance.
400 OperationUnsupported.HavipBindType You cannot bind HAVIP to network interface in the specified region. You are not allowed to associate ENIs in the specified region.
400 Forbidden.HaVip No permissions to perform operations on HAVIPs. Please apply for privilege--vpc_privilege_allow_buy_havip_instance. You do not have the permissions to manage the HAVIP. Go to the Quota Center page to acquire the permissions.
400 InvalidInstanceId.NotFound The specified Instance does not exist in the specified region. The instance does not exist in the specified region.
404 InvalidHaVipId.NotFound The specified HaVip does not exist in the specified region. The HAVIP does not exist in the region.

For a list of error codes, see Service error codes.