Adds secondary CIDR blocks to a virtual private cloud (VPC).

Usage notes

  • The following list describes the limits on the maximum number of secondary CIDR blocks that can be added:
    • You can add up to five secondary IPv4 CIDR blocks to each VPC.
    • You can add up to three secondary IPv6 CIDR blocks to each VPC.
  • You cannot repeatedly call the AssociateVpcCidrBlock operation to add secondary CIDR blocks to a VPC within the specified period of time.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
RegionId String Yes ch-hangzhou

The region ID of the VPC to which you want to add a secondary CIDR block.

You can call the DescribeRegions operation to query the most recent region list.

VpcId String Yes vpc-o6wrloqsdqc9io3mg****

The ID of the VPC.

SecondaryCidrBlock String No 192.168.0.0/16

The secondary IPv4 CIDR block. Take note of the following requirements:

  • You can specify one of the following standard IPv4 CIDR blocks or their subnets as the secondary IPv4 CIDR block: 192.168.0.0/16, 172.16.0.0/12, and 10.0.0.0/8.
  • You can also use a custom CIDR block other than 100.64.0.0/10, 224.0.0.0/4, 127.0.0.0/8, 169.254.0.0/16, or their subnets as the secondary IPv4 CIDR block of the VPC.

In addition, the following requirements must be met:

  • The CIDR block cannot start with 0. The subnet mask must be 8 to 28 bits in length.
  • The secondary CIDR block cannot overlap with the primary CIDR block or an existing secondary CIDR block.
Note You must set one of the SecondaryCidrBlock and Ipv6CidrBlock parameters.
IPv6CidrBlock String No 2408:XXXX:0:6a::/56

The IPv6 CIDR block.

Note You must set one of the SecondaryCidrBlock and Ipv6CidrBlock parameters.
Ipv6Isp String No BGP

The type of the IPv6 CIDR block. Valid values:

  • BGP (default): Alibaba Cloud Border Gateway Protocol (BGP) IPv6
  • ChinaMobile: China Mobile (single line)
  • ChinaUnicom: China Unicom (single line)
  • ChinaTelecom: China Telecom (single line)
Note If your Alibaba Cloud account is allowed to use single-ISP bandwidth, valid values are: ChinaTelecom, ChinaUnicom, and ChinaMobile.
IpVersion String No IPV4

The IP version. Valid values:

  • IPV4: IPv4
  • IPV6: IPv6. If you set IpVersion to IPV6 and do not set SecondaryCidrBlock, you can add IPv6 CIDR blocks to the VPC.
Action String Yes AssociateVpcCidrBlock

The operation that you want to perform. Set the value to AssociateVpcCidrBlock.

Response parameters

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

The ID of the request.

Examples

Sample requests

http(s)://[Endpoint]/?RegionId=ch-hangzhou
&VpcId=vpc-o6wrloqsdqc9io3mg****
&SecondaryCidrBlock=192.168.0.0/16
&IPv6CidrBlock=2408:XXXX:0:6a::/56
&Ipv6Isp=BGP
&IpVersion=IPV4
&Action=AssociateVpcCidrBlock
&Common request parameters

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

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

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

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

Error codes

HttpCode Error code Error message Description
400 InvalidCidrBlock.Malformed Specified CIDR block is not valid. The error message returned because the format of the specified CIDR block is invalid.
400 MissingParam.SecondaryCidrBlockOrIpv6CidrBlock Either SecondaryCidrBlock or Ipv6CidrBlock must be specified. The error message returned because the secondary CIDR block or the IPv6 CIDR block is not specified.
400 MissingParam.VpcId You must specify VpcId. The error message returned because the VpcId parameter is not configured.
403 Forbbiden User not authorized to operate on the specified resource. The error message returned because you are unauthorized to perform this operation on the specified resource. Apply for the required permissions and try again.

For a list of error codes, see Service error codes.