Creates a default virtual private cloud (VPC).

Usage notes

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

  • 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 10.0.0.0/8 and 10.1.0.0/16 are specified, only 10.0.0.0/8 takes effect.
  • CreateDefaultVpc is an asynchronous operation. After you send a request, the system returns a request ID and runs the task in the background. You can call the DescribeVpcAttribute operation to query the status of a default VPC:
    • 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.

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 cn-hangzhou

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

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

Ipv6CidrBlock String No 2408:XXXX:346:b600::/56

The IPv6 CIDR block of the default VPC.

Note This parameter is required if you set EnableIpv6 to true.
EnableIpv6 Boolean No false

Specifies whether to enable IPv6. Valid values:

  • false (default): no
  • true: yes
ResourceGroupId String No rg-acfmystnjq4****

The ID of the resource group.

Action String Yes CreateDefaultVpc

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

ClientToken String No 123e4567-e89b-12d3-a456-426655440000

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 set this parameter, ClientToken is set to the value of RequestId. The value of RequestId for each API request may be different.

Response parameters

Parameter Type Example Description
VpcId String vpc-bp15zckdt37pq72zv****

The ID of the default VPC.

VRouterId String vrt-bp1lhl0taikrteen8****

After you create a default VPC, the system automatically creates the ID of the vRouter.

RequestId String 0ED8D006-F706-4D23-88ED-E11ED28DCAC0

The ID of the request.

RouteTableId String vtb-bp1q1uirugzb1x32m****

After you create a default VPC, the system automatically creates the ID of the VPC route table.

Examples

Sample requests

http(s)://[Endpoint]/?RegionId=cn-hangzhou
&Ipv6CidrBlock=2408:XXXX:346:b600::/56
&EnableIpv6=false
&ResourceGroupId=rg-acfmystnjq4****
&Action=CreateDefaultVpc
&ClientToken=123e4567-e89b-12d3-a456-426655440000
&Common request parameters

Sample success responses

XML format

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

<CreateDefaultVpcResponse>
    <VpcId>vpc-bp15zckdt37pq72zv****</VpcId>
    <VRouterId>vrt-bp1lhl0taikrteen8****</VRouterId>
    <RequestId>0ED8D006-F706-4D23-88ED-E11ED28DCAC0</RequestId>
    <RouteTableId>vtb-bp1q1uirugzb1x32m****</RouteTableId>
</CreateDefaultVpcResponse>

JSON format

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

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

Error codes

HttpCode Error code Error message Description
400 InvalidParameter Specified CIDR block is not valid The error message returned because the specified CIDR block is invalid.
400 ResourceNotAvailable Resource you requested is not available in this region or zone. The error message returned because you cannot create a vSwitch in the current region or zone.
400 InvalidVpcName.Malformed Specified VPC name is not valid. The error message returned because the format of the VPC name is invalid. Enter a valid VPC name and try again.
400 InvalidVpcDiscription.Malformed Specified VPC description is not valid. The error message returned because the format of the VPC description is invalid.
400 QuotaExceeded.Vpc VPC quota exceeded. The error message returned because the number of VPCs in this account has reached the upper limit.
400 ResourceNotAvailable.Vpc Resource you requested is not available in this region or zone. The error message returned because the resource you requested is not available in this region or zone.
400 InvalidParameter Specified UserCidr invalid format. The error message returned because the format of the user CIDR block is invalid.
400 InvalidParameter Specified UserCidr Subnet mask is not valid . The error message returned because the subnet mask of the user CIDR block is invalid.
400 InvalidUserCidr.Quota Specified UserCidr number is greater than 3. The error message returned because the number of user CIDR blocks that you specify has reached the upper limit.
400 InvalidUserCidr.Malformed Specified UserCidr overlapping in of 100.64.0.0/10. The error message returned because the user CIDR block that you specify overlaps with 100.64.0.0/10.
400 InvalidResourceGroupId The specified ResourceGroupId does not exist. The error message returned because the specified resource group ID does not exist.
400 OperationFailed.DefaultVpcExist A default VPC already exists in the region. The error message returned because a default VPC already exists in the current region.
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.
404 InvalidRegionId.NotFound Specified value of "regionId" is not supported. The error message returned because RegionId is set to an invalid value. Check whether the service is available in the specified region.
500 InternalError The request processing has failed due to some unknown error. The error message returned because some unknown errors occurred.

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