Adds a secondary IPv4 CIDR block to a Virtual Private Cloud (VPC).

API description

By default, you can only add one secondary IPv4 CIDR block to a VPC. To increase the quota, open a ticket.

Make the API call

You can use OpenAPI Explorer to make API calls, search for API calls, perform debugging, and generate SDK example code.

Request parameters

Parameter Type Required? Example value Description
Action String Yes AssociateVpcCidrBlock

The name of this action. Valid value: AssociateVpcCidrBlock.

RegionId String Yes ch-hangzhou

The region of the VPC to which the secondary IPv4 CIDR block will be added. To query the region ID, call DescribeRegions.

VpcId String Yes vpc-o6wrloqsdqc9io3mg****

The ID of the VPC to which the secondary IPv4 CIDR block will be added.

SecondaryCidrBlock String No 192.168.0.0/16

The secondary IPv4 CIDR block to be added.

You can select from 192.168.0.0/16, 172.16.0.0/12, and 10.0.0.0/8, or from their subnets as the secondary IPv4 CIDR block.

To use a public IP address range as a secondary IPv4 CIDR block of the VPC, open a ticket.

Note the following limits when adding a secondary IPv4 CIDR block:

  • The CIDR block cannot start with 0. The mask length ranges from 8- to 24-bit.
  • The secondary CIDR block cannot overlap with the primary CIDR block of the VPC or other added secondary CIDR blocks.

    For example, in a VPC with the primary IPv4 CIDR block 192.168.0.0/16, you cannot add the following CIDR block as a secondary IPv4 CIDR block.

    • A CIDR block larger than 192.168.0.0/16, for example, 192.168.0.0/8.
    • The same CIDR block as 192.168.0.0/16.
    • A CIDR block smaller than 192.168.0.0/16, for example, 192.168.0.0/24.

Response parameters

Parameter Type Example value Description
RequestId String C1221A1F-2ACD-4592-8F27-474E02883159

The ID of the request.

Examples

Request example


http(s)://vpc.aliyuncs.com/? Action=AssociateVpcCidrBlock
&RegionId=ch-hangzhou
&VpcId=vpc-o6wrloqsdqc9io3mg****
&<CommonParameters>

Response example

XML format

<AssociateVpcCidrBlockResponse>
         <RequestId>C1221A1F-2ACD-4592-8F27-474E02883159</RequestId>
</AssociateVpcCidrBlockResponse>

JSON format

{
	"RequestId":"C1221A1F-2ACD-4592-8F27-474E02883159"
}

Errors

HTTP status code Error code Error message Description
400 InvalidCidrBlock.Malformed Specified CIDR block is not valid. The specified CIDR format is invalid.
403 Forbbiden User not authorized to operate on the specified resource. You are not authorized to operate on this resource.

For a list of error codes, visit the API Error Center.