All Products
Document Center

Virtual Private Cloud:CreateDefaultVpc

Last Updated:Dec 02, 2023

Creates a default virtual private cloud (VPC).

Operation Description

Usage notes

When you call this operation, take note of the following items:

  • After you create a default VPC, you cannot change its CIDR block. However, you can add secondary IPv4 CIDR blocks to it.

  • In each default VPC, cloud services can use a maximum of 60,000 private IP addresses. You cannot increase the quota.

  • After you create a default VPC, a vRouter and a route table are automatically created for the VPC.

  • At most three user CIDR blocks can be added to a VPC. If a user CIDR block includes another user CIDR block, the one with the shorter subnet mask takes effect. For example, if and are specified, only takes effect.

  • CreateDefaultVpc is an asynchronous operation. After a request is sent, the system returns a request ID and runs the task in the background. You can call the DescribeVpcAttribute operation to query the status of the task:

    • If the default VPC is in the Pending state, the VPC is being configured.
    • If the default VPC is in the Available state, the VPC is available.
  • You cannot repeatedly call the CreateDefaultVpc operation within a specific time period.

  • You can create only one default VPC in each region.


You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.


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

Request parameters


The ID of the region to which the default VPC belongs.

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


The IPv6 CIDR block of the default VPC.

Note When EnableIpv6 is set to true, this parameter is required.

Specifies whether to enable IPv6. Valid values:

  • false (default)
  • true

The ID of the resource group.


The client token that is used to ensure the idempotence of the request.

You can use the client to generate the token, but you must make sure that the token is unique among different requests. The token can contain only ASCII characters.

Note If you do not specify this parameter, the system automatically uses the request ID as the client token. The request ID may be different for each request.

Response parameters


The ID of the default VPC.


The ID of the default VPC.


The vRouter ID that is automatically created by the system after you create a default VPC.


The request ID.


The route table ID that is automatically created by the system after you create a default VPC.



Sample success responses


  "VpcId": "vpc-bp15zckdt37pq72zv****",
  "VRouterId": "vrt-bp1lhl0taikrteen8****",
  "RequestId": "0ED8D006-F706-4D23-88ED-E11ED28DCAC0",
  "RouteTableId": "vtb-bp1q1uirugzb1x32m****"

Error codes

HTTP status codeError codeError messageDescription
400TOKEN_PROCESSINGAction is processing.-
400InvokeErrorinstance quota rule invoke error.-
400InvalidParameterSpecified CIDR block is not validThe specified CIDR block is invalid.
400ResourceNotAvailableResource you requested is not available in this region or zone.You cannot create a vSwitch in the current region or zone.
400InvalidVpcName.MalformedSpecified VPC name is not valid.The format of the VPC name is invalid. Enter a valid VPC name and try again.
400InvalidVpcDiscription.MalformedSpecified VPC description is not valid.The format of the VPC description is invalid.
400QuotaExceeded.VpcVPC quota exceeded.The number of VPCs in this account has reached the upper limit.
400ResourceNotAvailable.VpcResource you requested is not available in this region or zone.The resource you requested is not available in this region or zone.
400InvalidParameterSpecified UserCidr invalid format.The format of the user CIDR block is invalid.
400InvalidParameterSpecified UserCidr Subnet mask is not valid .The subnet mask of the user CIDR block is invalid.
400InvalidUserCidr.QuotaSpecified UserCidr number is greater than 3.The number of user CIDR blocks that you specify has reached the upper limit.
400InvalidUserCidr.MalformedSpecified UserCidr overlapping in of user CIDR block that you specify overlaps with
400InvalidResourceGroupIdThe specified ResourceGroupId does not exist.The specified resource group ID does not exist.
400OperationFailed.DefaultVpcExistA default VPC already exists in the region.The error message returned because the default VPC already exists in the current region.
403ForbbidenUser not authorized to operate on the specified resource.The error message returned because you are unauthorized to perform this operation on the specified resource. Acquire the required permissions and try again.
404InvalidRegionId.NotFoundSpecified value of "regionId" is not supported.RegionId is set to an invalid value. Check whether the service is available in the specified region and try again.
500InternalErrorThe request processing has failed due to some unknown error.An unknown error occurred.

For a list of error codes, visit the Service error codes.