AssociateVpcCidrBlock
1. API Description
This API (AssociateVpcCidrBlock) is used to add a secondary IPv4 CIDR block to a VPC.
2. Input Parameters
The following request parameter list only provides API request parameters.
vpcId
Yes
String
ID of the VPC.
The default VPC does not support adding secondary CIDR blocks.
It can be obtained by calling DescribeVpcs.
cidrBlock
Yes
String
Secondary IPv4 CIDR block to be added.
The mask length ranges from 9 to 29, and the starting address of the CIDR block must be specified, for example 10.0.0.0/16.
It cannot overlap with the primary CIDR block or the existing secondary CIDR blocks of this VPC.
It cannot overlap with the following reserved CIDR blocks: 0.0.0.0/8, 100.64.0.0/10, 127.0.0.0/8, 169.254.0.0/16, and 224.0.0.0/4.
The maximum number of CIDR blocks of a single VPC is controlled by the quota ZEC_CIDR_IPv4_Blocks_per_VPC, which is 5 by default and can be increased upon request.
This quota counts the total number of the primary CIDR block and the secondary CIDR blocks, so up to 4 secondary CIDR blocks can be added under the default quota.
3. Output Parameters
requestId
String
The unique request ID, which is returned for each request.
RequestId is required for locating a problem.
4. Code Example
1. Add a secondary CIDR block to a VPC.
POST /api/v2/zec HTTP/1.1
Host: console.zenlayer.com
Content-Type: application/json
X-ZC-Action: AssociateVpcCidrBlock
<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.
404
INVALID_VPC_NOT_FOUND
The global VPC does not exist.
400
INVALID_CIDR_BLOCK_FORMAT
Invalid CIDR block format.
400
INVALID_CIDR_BLOCK_NETMASK_RANGE
CIDR block range is invalid.
400
INVALID_CIDR_BLOCK_NOT_EMPTY
CIDR block cannot be empty.
400
INVALID_IP_BROADCAST_ADDRESS
The IP address cannot be a broadcast address.
400
OPERATION_DENIED_DEFAULT_VPC
The default global VPC cannot be modified.
400
OPERATION_DENIED_VPC_CIDR_OVERLAP
The CIDR blocks of the VPC overlap with each other.
400
OPERATION_DENIED_VPC_CIDR_RESERVED
The CIDR block of the VPC overlaps with a reserved CIDR block and cannot be used.
400
OPERATION_DENIED_VPC_SECONDARY_CIDR_EXISTS
The secondary CIDR block of the VPC already exists.
Last updated