Associates elastic IP addresses (EIPs) with an instance in the same region.
Usage notes
- You can call AssociateEipAddressBatch to associate EIPs with an instance in the same region. The instance must be a NAT gateway or a secondary elastic network interface (ENI). To associate EIPs with other instances, see AssociateEipAddress.
- AssociateEipAddressBatch 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 DescribeEipAddresses operation to query the status of the task.
- If the EIP is in the Associating state, the EIP is being associated. In this state, you can only query the EIP and cannot perform other operations.
- If the EIP is in the InUse state, the EIP is associated.
- You cannot repeatedly call AssociateEipAddressBatch within a specific period of time.
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
RegionId | String | Yes | cn-hangzhou | The ID of the region to which the EIPs belong. You can call the DescribeRegions operation to query the most recent region list. |
BindedInstanceId | String | Yes | ngw-hp3akk9irtd69jad**** | The ID of the instance to be associated with EIPs. The instance can be a NAT gateway or a secondary ENI. |
BindedInstanceType | String | Yes | Nat | The type of instance with which you want to associate the EIPs. Valid values:
|
Mode | String | No | MULTI_BINDED | The association mode. Set the value to MULTI_BINDED, which specifies the Multi-EIP-to-ENI mode. This parameter is required only if InstanceType is set to NetworkInterface. |
InstanceIds.N | String | No | eip-2zeerraiwb7ujsxdc**** | The IDs of the EIPs. Specify at least one ID and at most 50 IDs. |
ClientToken | String | No | 02fb3da4-130e-11e9-8e44-0016e04115b | 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 all 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. |
Action | String | Yes | AssociateEipAddressBatch | The operation that you want to perform. Set the value to AssociateEipAddressBatch. |
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
RequestId | String | 54B48E3D-DF70-471B-AA93-08E683A1B45 | The request ID. |
Examples
Sample requests
http(s)://[Endpoint]/?RegionId=cn-hangzhou
&BindedInstanceId=ngw-hp3akk9irtd69jad****
&BindedInstanceType=Nat
&Mode=MULTI_BINDED
&InstanceIds=["eip-2zeerraiwb7ujsxdc****\t"]
&ClientToken=02fb3da4-130e-11e9-8e44-0016e04115b
&Action=AssociateEipAddressBatch
&Common request parameters
Sample success responses
XML
format
HTTP/1.1 200 OK
Content-Type:application/xml
<AssociateEipAddressBatchResponse>
<RequestId>54B48E3D-DF70-471B-AA93-08E683A1B45</RequestId>
</AssociateEipAddressBatchResponse>
JSON
format
HTTP/1.1 200 OK
Content-Type:application/json
{
"RequestId" : "54B48E3D-DF70-471B-AA93-08E683A1B45"
}
Error codes
HttpCode | Error code | Error message | Description |
---|---|---|---|
400 | InvalidAssociation.Duplicated | Specified instance already is associated. | An EIP or a GA instance is already associated with the specified instance. You must disassociate the EIP or GA instance from the specified instance before you can perform the operation. |
400 | OperationDenied | Specified instance is not in VPC. | The specified instance does not exist in the VPC. |
400 | InvalidParameter.Mismatch | Specified elastic IP address and ECS instance are not in the same region. | The specified EIP and ECS instance do not belong to the same region. |
400 | IncorrectEipStatus | Current elastic IP status does not support this operation | The status of the EIP does not support the operation. |
400 | IncorrectInstanceStatus | Current instance status does not support this operation. | This operation cannot be performed while the instance is in the current state. |
400 | InvalidInstanceType.ValueNotSupported | The specified value of InstanceType is not supported. | InstanceType is set to an invalid value. |
400 | InvalidParameter | The specified parameter is not valid. | The parameter is set to an invalid value. |
400 | OperationDenied | Eip of default vpc not allow this operation | The operation is not supported by EIPs in the default VPC. |
400 | Forbidden | The eip instance owener error | You are unauthorized to perform the operation on the EIP. |
400 | TaskConflict | The eip operate too frequent, TaskConflict. | The operations are too frequent and tasks conflict with each other. |
400 | InvalidBindingStatus | The eip binding status invalid. | The EIP is in an invalid state. |
400 | BIND_INSTANCE_HAVE_PORTMAP_OR_BIND_EIP | The instance may have portMap or already bind eip. | A port forwarding rule is configured for the ECS instance. Delete the port forwarding rule and try again. |
400 | BIND_INSTANCE_OWENER_ERROR | Cannot operate the eip. | You are unauthorized to manage the specified EIP. |
400 | QuotaExceeded.NumberOfEip | Binded eip Quota exceed on this NatGw. | The number of EIPs associated with the NAT gateway exceeds the upper limit. |
400 | InvalidAction.Denied | Action is denied due to unfinished Eip configuration modification. | The EIP configurations are not complete and the operation is denied. |
400 | InvalidParams.NotFound | instance not found | The specified instance does not exist. |
400 | Eni.Attached | The eni should be detached from ecs when associating with direct eip. | If the ENI is associated with an EIP in cut-through mode, you must disassociate the ENI from the ECS instance. |
400 | InvalidEIPStatus.BizDisabled | The EIP has been locked. | The EIP is locked. |
400 | Forbidden.FinancialLocked | The ip business status is invalid. | The instance has overdue payments. |
400 | OperationDenied.Unauthorized | The operation is not allowed because the user is not in the whitelist. | The operation is not allowed because you are not in the whitelist. |
400 | OperationDenied.UnsupportedEipBindMode | The operation is not supported for the NAT gateway due to its EIP binding mode. | The operation is not supported by the EIP binding mode of the NAT gateway. |
404 | InvalidInstanId.NotFound | Specified instance does not exist. | The specified instance does not exist. Check whether the instance ID is valid. |
404 | InvalidAllocationId.NotFound | Specified allocation ID is not found | The specified EIP does not exist. Check whether the specified value is valid. |
404 | Forbidden.RegionNotFound | Specified instance is not found during access authentication. | The region is not supported. |
404 | OperationDenied.VpcIpv4GatewayEnabled | The operation is not allowed because of the VPC of the NAT gateway has opened IPv4 Gateway. | IPv4 gateways are enabled for the VPC where the NAT gateway resides and the operation is denied. |
For a list of error codes, see Service error codes.