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

Usage notes

  • The following content describes the limits on the 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 within a specific 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 specify one of SecondaryCidrBlock and Ipv6CidrBlock.
IPv6CidrBlock String No 2408:XXXX:0:6a::/56

The IPv6 CIDR block.

Note You must specify one of SecondaryCidrBlock and Ipv6CidrBlock.
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
  • IPV6: IPv6. If you set IpVersion to IPV6 and do not specify SecondaryCidrBlock, you can add IPv6 CIDR blocks to the VPC.
IpamPoolId String No ipam-pool-wxfq2iawjyfizg****

The ID of the IP Address Management (IPAM) address pool.

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 request ID.

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
&IpamPoolId=ipam-pool-wxfq2iawjyfizg****
&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 format of the specified CIDR block is invalid.
400 MissingParam.SecondaryCidrBlockOrIpv6CidrBlock Either SecondaryCidrBlock or Ipv6CidrBlock must be specified. The secondary CIDR block or the IPv6 CIDR block is not specified.
400 MissingParam.VpcId You must specify VpcId. VpcId is not specified.
403 Forbbiden User not authorized to operate on the specified resource. You are unauthorized to perform this operation on the specified resource. Apply for the required permissions and try again.
500 OperationFailed.ResourceNotEnough Insufficient resources. The resources that you request are insufficient. If you still want to request the resources, submit a ticket.

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