All Products
Search
Document Center

Elastic IP Address:AssociateEipAddressBatch

Last Updated:Jul 10, 2026

Associates multiple elastic IP addresses (EIPs) with a cloud service instance in the same region in a batch.

Operation description

  • AssociateEipAddressBatch associates multiple EIPs with a cloud service instance in a batch. This operation supports only batch attachment of EIPs to an Internet NAT gateway instance or a secondary network interface controller (NIC) instance in the same region. To associate an EIP with other cloud service instances, call AssociateEipAddress.

  • AssociateEipAddressBatch is an asynchronous operation. After you invoke this operation, the system returns a request ID, but the EIP instances are not yet attached to the cloud service instance. The attachment task continues to run in the background. You can invoke DescribeEipAddresses to query the status of an EIP instance:
    • If the EIP instance is in the Associating state, the EIP instance is being attached. In this state, you can only execute query operations.

    • If the EIP instance is in the InUse state, the EIP instance is attached.

  • AssociateEipAddressBatch does not support concurrent attachment of the same EIP instance with cloud service instances.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

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 None

Request parameters

Parameter

Type

Required

Description

Example

RegionId

string

Yes

The region ID of the EIPs to associate with the cloud service instance.

You can call DescribeRegions to query the region ID.

cn-hangzhou

BindedInstanceId

string

Yes

The ID of the cloud service instance to attach the EIPs to.

You can specify the instance ID of an Internet NAT gateway instance or a secondary network interface controller (NIC) instance.

ngw-hp3akk9irtd69jad****

BindedInstanceType

string

Yes

The type of the instance to attach the EIPs to. Valid values:

  • Nat: Internet NAT gateway.

  • NetworkInterface: secondary network interface controller (NIC).

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 InstanceType is set to NetworkInterface.

MULTI_BINDED

InstanceIds

array

Yes

The list of EIPs to associate with the cloud service instance.

You must specify at least 1 EIP and can specify up to 50 EIPs.

string

No

The ID of the EIP instance to associate with the cloud service instance.

You must specify at least 1 EIP instance ID and can specify up to 50 EIP instance IDs.

eip-2zeerraiwb7ujsxdc****

RegionId

string

Yes

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 RequestId of the API request as the ClientToken. The RequestId may be different for each API request.

cn-hangzhou

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 elements

Element

Type

Description

Example

object

The response parameters.

RequestId

string

The request ID.

54B48E3D-DF70-471B-AA93-08E683A1B45

Examples

Success response

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.
400 OperationDenied Specified instance is not in VPC.
400 InvalidParameter.Mismatch Specified elastic IP address and ECS instance are not in the same region.
400 IncorrectEipStatus Current elastic IP status does not support this operation
400 IncorrectInstanceStatus Current instance status does not support this operation.
400 InvalidInstanceType.ValueNotSupported The specified value of InstanceType is not supported.
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.
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.
400 BIND_INSTANCE_HAVE_PORTMAP_OR_BIND_EIP The instance may have portMap or already bind eip. The ECS instance already has a port forwarding rule (DNAT). Delete the corresponding port forwarding rule before performing the operation.
400 EIP_CAN_NOT_ASSOCIATE_WITH_PUBLIC_IP instance already bind natpublicip,cannot bind eip.
400 BIND_INSTANCE_OWENER_ERROR Cannot operate the 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
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.
404 InvalidAllocationId.NotFound Specified allocation ID is not found.
404 InvalidInstanId.NotFound Specified instance does not exist.
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.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.