AssociateEipAddress

1. API Description

This API is used to associate elastic IPs to resources in the same region.

Note

  • You can call DescribeLoadBalancers to query supported load balancers.

  • You can call DescribeNetworkInterfaces to query supported vNIC.

  • You can call DescribeNatGateways to query supported NAT gateway.

  • You must specify exactly one of the following parameters: loadBalancerId, nicId, or natId, in order of priority: loadBalancerId > nicId > natId.

  • If the upper limit is exceeded, please contact us to request a quota increase.

  • The API returns the elastic IP IDs that failed to operate. An empty list indicates all operations succeeded.

2. Input Parameters

The following request parameter list only provides API request parameters.

Parameter Name
Required
Type
Description

loadBalancerId

No

String

Load balancer ID.

nicId

No

String

vNIC ID.

lanIp

No

String

Private IP.

If nicId is provided, this field is required.

natId

No

String

NAT gateway ID.

eipIds

Yes

Array of String

ID list of elastic IPs.

3. Output Parameters

Parameter Name
Type
Description

failedEipIds

Array of String

Elastic IP IDs that failed to bind.

requestId

String

The unique request ID, which is returned for each request. RequestId is required for locating a problem.

4. Code Example

Associate elastic IPs to resources in the same region.

POST /api/v2/zec HTTP/1.1
Host: console.zenlayer.com
Content-Type: application/json
X-ZC-Action: AssociateEipAddress


Request:
{
  "loadBalancerId": "xxx",
  "nicId": "xxx",
  "lanIp": "xxx",
  "natId": "xxx",
  "eipIds": ["xxx","xxx"]
}

Response:
{
  "requestId": "TBFC01FCF-6439-4530-ADBC-16809F0C3E8F",
  "response": {
    "failedEipIds":[],
    "requestId": "TBFC01FCF-6439-4530-ADBC-16809F0C3E8F"
  }
}

5. Developer Resources

Zenlayer Cloud API 2.0 integrates SDKs to make it easier for you to call APIs. More programming languages will be supported.

6. Error Codes

The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

HTTP Status Code
Error Code
Description

404

INVALID_LB_NOT_FOUND

Load balancer does not exist.

400

INVALID_LB_STATUS

State of load balancer is not supported.

400

INVALID_REGION_MISMATCH

Regions of the load balancer and the elastic IP are different.

400

OPERATION_DENIED_EIP_ASSIGNED_LIMIT_EXCEEDED

The number of elastic IPs that can be associated to the load balancer has exceeded the limit.

Last updated