Associates elastic IP addresses (EIPs) with an instance in the same region.
Operation description
-
You can call the AssociateEipAddressBatch operation to associate EIPs with an instance in the same region. The instance must be a NAT gateway or a secondary elastic network interface (ENI). For more information about how 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. 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 call the AssociateEipAddressBatch operation to associate an EIP with multiple instances at a time.
Debugging
Authorization information
The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action
policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:
- Operation: the value that you can use in the Action element to specify the operation on a resource.
- Access level: the access level of each operation. The levels are read, write, and list.
- Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
- The required resource types are displayed in bold characters.
- If the permissions cannot be granted at the resource level,
All Resources
is used in the Resource type column of the operation.
- Condition Key: the condition key that is defined by the cloud service.
- Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
Operation | Access level | Resource type | Condition key | Associated operation |
---|---|---|---|---|
vpc:AssociateEipAddressBatch | update | *Address acs:vpc:{#regionId}:{#accountId}:eip/{#AllocationId} *Instance acs:vpc:{#regionId}:{#accountId}:instance/{#InstanceId} *NatGateway acs:vpc:{#regionId}:{#accountId}:natgateway/{#NatGatewayId} |
| none |
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
RegionId | string | Yes | The ID of the region to which the EIPs belong. You can call the DescribeRegions operation to query the region ID. | cn-hangzhou |
BindedInstanceId | string | Yes | The ID of the instance with which you want to associate the EIPs. The instance can be a NAT gateway or a secondary ENI. | ngw-hp3akk9irtd69jad**** |
BindedInstanceType | string | Yes | The type of the instance with which you want to associate the EIPs. Valid values:
| Nat |
Mode | string | No | The association mode. Set the value to MULTI_BINDED, which specifies the Multi-EIP-to-ENI mode. This parameter is required only when BindedInstanceType is set to NetworkInterface. | MULTI_BINDED |
InstanceIds | array | Yes | The EIPs to be associated with the instance. You must enter at least one EIP. You can enter up to 50 EIPs. | |
string | Yes | The IDs of the EIPs to be associated with the instance. You must enter at least one ID. You can enter up to 50 IDs. | eip-2zeerraiwb7ujsxdc**** | |
ClientToken | string | No | The client token that is used to ensure the idempotence of the request. You can use the client to generate a 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.
| 02fb3da4-130e-11e9-8e44-0016e04115b |
Response parameters
Examples
Sample success responses
JSON
format
{
"RequestId": "54B48E3D-DF70-471B-AA93-08E683A1B45"
}
Error codes
HTTP status code | 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 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 | IncorrectHaVipStatus | HaVip can be operated by this action only when it's status is Available or InUse. | The operation supports only HAVIPs in the Available or InUse state. |
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 a default VPC. |
400 | Forbidden | The eip instance owener error | The EIP does not belong to your account. Check whether you have the permissions to perform the operation on the EIP. |
400 | TaskConflict | The eip operate too frequent, TaskConflict. | 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 | EIP_CAN_NOT_ASSOCIATE_WITH_PUBLIC_IP | instance already bind natpublicip,cannot bind eip. | - |
400 | BIND_INSTANCE_OWENER_ERROR | Cannot operate the eip. | You are unauthorized to manage the specified EIP. |
400 | NATGATEWAY_FINANCIALLOCKED | The NatGateway has expire, cannot do bind operation. | - |
400 | InvalidParameter.InstanceTypeNotSupport | The specified instance type is not support. | - |
400 | QuotaExceeded.NumberOfTrafficEip | The number of traffic eip on natgw exceed limitation. | - |
400 | QuotaExceeded.NumberOfEip | Binded eip Quota exceed on this NatGw. | The number of EIPs associated with the NAT gateway exceeds the upper limit. |
400 | InvalidEipBandwidth.OutOfMaxValue | The Eip Bandwidth is invalid. | - |
400 | Forbidden.EipCanNotBindGatgw | Eip can not bind on natgw. | - |
400 | InvalidAction.Denied | Action is denied due to unfinished Eip configuration modification. | The EIP configurations are not complete and the operation is denied. |
400 | InstanceType.NotSupport | The instance type is invalid. | - |
400 | InvalidParams.NotFound | instance not found | The specified instance does not exist. |
400 | BindInstance.NotSupported | bind instance type %s is not supported. | - |
400 | Forbidden.InstanceBandwidthNotZero | Eip can not bind with instance when it's bandwidth is not zero. | - |
400 | INSTANCE_TYPE_NOT_SUPPORT | The instance type is invalid. | - |
400 | ServerRegion.Invalid | Eip bind remote server region invalid. | - |
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 | Invalid.DirectEip.BindType | The direct eip can be only associated with eni. | - |
400 | Invalid.Function.NotSupported | Multi-IP function is under test, the region or uid is not supported. | - |
400 | InvalidStatus.EniStatusNotSupport | %s | - |
400 | InvalidParameter.EniInstanceId | %s | - |
400 | %s | %s | - |
400 | EipBatchBind.TypeNotSupport | eip batch bind type not support | - |
400 | OperationFailed.RegionNotMatch | The specified eip is not in this region | - |
400 | InvalidEIPStatus.BizDisabled | The EIP has been locked. | The error message returned because the EIP is locked. |
400 | Forbidden.FinancialLocked | The ip business status is invalid. | The error message returned because 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. |
400 | OperationDenied.Ipv4GatewayExist | The operation is not allowed because of Ipv4GatewayExist. | The EIP failed to be associated because IPv4 gateways exist in the VPC. |
404 | InvalidAllocationId.NotFound | Specified allocation ID is not found. | The error message returned because the specified EIP does not exist. Check whether the value of the parameter is valid. |
404 | InvalidInstanId.NotFound | Specified instance does not exist. | The specified instance does not exist. |
404 | InvalidRegionId.NotFound | Specified value of InstanceRegionId is not supported. | - |
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 error message returned because 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, visit the Service error codes.
Change history
Change time | Summary of changes | Operation |
---|---|---|
2023-09-21 | API Description Update. The API operation is not deprecated.. The Error code has changed | View Change Details |
2023-06-26 | The Error code has changed | View Change Details |
2023-05-15 | The Error code has changed | View Change Details |
2023-03-23 | The Error code has changed | View Change Details |