All Products
Search
Document Center

Virtual Private Cloud:AssociateVpcCidrBlock

Last Updated:Aug 29, 2024

Adds a secondary CIDR block to a VPC.

Operation description

  • Take note of the following limits:

    • Each VPC can contain up to five secondary IPv4 CIDR blocks.
    • Each VPC can contain up to five secondary IPv6 CIDR blocks.
  • 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.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
vpc:AssociateVpcCidrBlockcreate
  • VPC
    acs:vpc:{#regionId}:{#accountId}:vpc/{#VpcId}
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
RegionIdstringYes

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

ch-hangzhou
VpcIdstringYes

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

vpc-o6wrloqsdqc9io3mg****
SecondaryCidrBlockstringNo

The IPv4 CIDR block to be added. 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 of the VPC: 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.

The CIDR block must meet the following requirements:

  • The CIDR block cannot start with 0. The subnet mask must be 8 to 28 bits in length.
  • The CIDR block cannot overlap with the primary CIDR block or an existing secondary CIDR block of the VPC.
Note You must and can specify only one of SecondaryCidrBlock and Ipv6CidrBlock.
192.168.0.0/16
IPv6CidrBlockstringNo

The IPv6 CIDR block to be added.

Note You must and can specify only one of SecondaryCidrBlock and Ipv6CidrBlock.
2408:XXXX:0:6a::/56
Ipv6IspstringNo

The type of the IPv6 CIDR block. Valid values:

  • BGP (default)
  • ChinaMobile
  • ChinaUnicom
  • ChinaTelecom
Note If your Alibaba Cloud account is allowed to activate single-ISP bandwidth, you can set this parameter to ChinaTelecom, ChinaUnicom, or ChinaMobile.
BGP
IpVersionstringNo

The version of the IP address. Valid values:

  • IPV4: the IPv4 address.
  • IPV6: the IPv6 address. If you set IpVersion to IPV6 and do not specify SecondaryCidrBlock, you can add a secondary IPv6 CIDR block to the VPC.
IPV4
IpamPoolIdstringNo

The ID of the IP Address Manager (IPAM) pool that contains IPv4 addresses.

ipam-pool-sycmt3p2a9v63i****

Response parameters

ParameterTypeDescriptionExample
object

The response parameters.

RequestIdstring

The request ID.

C1221A1F-2ACD-4592-8F27-474E02883159

Examples

Sample success responses

JSONformat

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

Error codes

HTTP status codeError codeError messageDescription
400InvalidVpc.NotFound%s-
400IncorrectStatus.Vpc%s-
400ParamExclusive.SecondaryCidrAndIpv6Cidr%s-
400OperationUnsupported.VpcMultiCidr%s-
400MissingParam.SecondaryCidrOrIpv6Cidr%s-
400OperationUnsupported.IPv6ULA%s-
400OperationFailed.Ipv6CidrBlockExisted%s-
400InvalidIpv6ULACidrBlock.Malformed%s-
400QuotaExceeded.GUAIpv6CidrBlock%s-
400IllegalParam.Ipv6CidrType%s-
400OperationUnsupported.OnlyULA%s-
400InvalidCidrBlock.MalformedSpecified CIDR block is not valid.The format of the CIDR block is invalid.
400IllegalParam.SecondaryCidrBlock%s-
400Duplicated.SecondaryCidrBlock%s-
400OperationFailed.ConflictWithEntry%s-
400QuotaExceeded.VpcMultiCidr%s-
400MissingParam.SecondaryCidrBlockOrIpv6CidrBlockEither SecondaryCidrBlock or Ipv6CidrBlock must be specified.The secondary CIDR block or the IPv6 CIDR block is not specified.
400MissingParam.VpcIdYou must specify VpcId.You must specify VpcId.
400UnsupportedFeature.Ipv6IspThe Ipv6Isp feature is not supported.The specified IPv6 ISP is not supported.
400IllegalParam.IpVersion%s-
400OperationDenied.GUAIpv6CidrBlockThe operation is not allowed because this ipv6 CIDR is not reserved.-
400OperationFailed.IPv6CidrNotReservedOperation failed because this ipv6 cidr is not reserved.-
400InvalidCidrBlockSpecified CIDR block is already exists.The vSwitch CIDR block overlaps with another vSwitch CIDR block or with the destination CIDR block of a custom route entry. Try a different CIDR block that is not in use.
403ForbbidenUser not authorized to operate on the specified resource.User not authorized to operate on the specified resource.
500OperationFailed.ResourceNotEnoughInsufficient 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, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2024-08-28The Error code has changedView Change Details
2024-05-21The Error code has changedView Change Details
2024-04-25The Error code has changed. The request parameters of the API has changedView Change Details
2023-08-24API Description Update. The Error code has changedView Change Details
2023-04-14The Error code has changedView Change Details
2023-04-13The Error code has changed. The request parameters of the API has changedView Change Details