For the complete documentation index, see llms.txt. This page is also available as Markdown.

UnassociateVpcCidrBlock

1. API Description

This API (UnassociateVpcCidrBlock) is used to remove a secondary IPv4 CIDR block from a VPC.

Notes

  • Concurrent CIDR block operations on the same VPC are not supported. Please call the interface serially.

2. Input Parameters

The following request parameter list only provides API request parameters.

Parameter Name
Required
Type
Description

vpcId

Yes

String

ID of the VPC.

The default VPC does not support removing secondary CIDR blocks.

It can be obtained by calling DescribeVpcs.

cidrBlock

Yes

String

Secondary IPv4 CIDR block to be removed.

It must be exactly the same as one of the existing secondary CIDR blocks of this VPC.

Only secondary CIDR blocks can be removed: passing in the primary CIDR block is rejected. The primary CIDR block cannot be deleted and can only be expanded or shrunk within the original CIDR block through ModifyVpcAttribute.

No subnet may exist under this secondary CIDR block, otherwise the request is rejected. Delete all subnets under this CIDR block first.

Secondary CIDR blocks cannot be modified. To adjust the size, remove the CIDR block first and then call AssociateVpcCidrBlock again to add it.

3. Output Parameters

Parameter Name
Type
Description

requestId

String

The unique request ID, which is returned for each request.

RequestId is required for locating a problem.

4. Code Example

1. Remove a secondary CIDR block from a VPC.

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

Request:
{
  "vpcId": "<vpcId>",
  "cidrBlock": "172.16.0.0/16"
}

Response:
{
  "requestId": "T05992D0C-7E8B-4047-B0C0-780F2CD549D3",
  "response": {
    "requestId": "T05992D0C-7E8B-4047-B0C0-780F2CD549D3"
  }
}

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_VPC_NOT_FOUND

The global VPC does not exist.

404

INVALID_VPC_SECONDARY_CIDR_NOT_FOUND

The specified secondary CIDR block does not exist.

400

INVALID_CIDR_BLOCK_FORMAT

Invalid CIDR block format.

400

INVALID_CIDR_BLOCK_NOT_EMPTY

CIDR block cannot be empty.

400

OPERATION_DENIED_DEFAULT_VPC

The default global VPC cannot be modified.

400

OPERATION_DENIED_VPC_CIDR_HAS_SUBNET

The CIDR block still has subnets and cannot be removed.

400

OPERATION_DENIED_VPC_PRIMARY_CIDR_UNASSOCIATE

The primary CIDR block cannot be deleted.

Last updated