BindCidrBlockIps

1. API Description

This API is used to bind one or more CIDR block IPs to instances.

Note

  • Only operations on CIDR blocks in AVAILABLE status are supported.

  • CIDR block IPs can only be assigned to instances in the same zone.

  • The instance to be assigned a CIDR block IP should be in status of RUNNING.

  • This API is an async API. A request ID is returned after the request is sent. However, it does not mean the binding has been completed. You can use DescribeCidrBlockIps to query the status of the CIDR block IPs.

  • You need first assign an IPv4 CIDR to the instance before adding another IPv6 CIDR.

2. Input Parameters

The following request parameter list only provides API request parameters.

Parameter NameRequiredTypeDescription

cidrBlockId

Yes

String

ID of the CIDR block.

You can find the cidrBlockId in the response by calling DescribeCidrBlocks.

ipBindList

Yes

Array of IpBindParam

List of IPs to be assigned.

3. Output Parameters

Parameter NameTypeDescription

requestId

String

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

4. Code Example

Assign CIDR block IPs to instances.

POST /api/v2/bmc HTTP/1.1
Host: console.zenlayer.com
Content-Type: application/json
X-ZC-Action: BindCidrBlockIps
<Common Request Params>

Request:
{
  "cidrBlockId": "cidrBlockId",
  "ipBindList": [
    {
      "instanceId": "instanceId1",
      "ip": "1111:1111:2:25::2"
    },
    {
      "instanceId": "instanceId2",
      "ip": "1.1.1.1"
    }
  ]
}

Response:
{
  "requestId": "T2979BBDB-5B06-444F-857E-93FEFE665C0D",
  "response": {
    "requestId": "T2979BBDB-5B06-444F-857E-93FEFE665C0D"
  }
}

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 CodeError CodeDescription

404

INVALID_CIDRBLOCK_NOT_FOUND

CIDR block not found.

404

INVALID_INSTANCE_NOT_FOUND

Instance not found.

403

OPERATION_DENIED_INSTANCE_NOT_RUNNING

Instance status should be RUNNING.

403

OPERATION_DENIED_DIFFERENT_ZONE

CIDR block and instance should be in the same zone.

403

OPERATION_DENIED_CIDRBLOCK_RECYCLED

Operations on CIDR block in recycle bin are not supported.

403

OPERATION_DENIED_CIDRBLOCK_IP_COUNT_REACH_LIMIT

Number of IPs assigned to an instance exceeds the limit.

403

OPERATION_DENIED_SERVER_NO_IPV4

No IPv4 CIDR assigned to the instance.

Last updated