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 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 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.
Debugging
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.
Operation | Access level | Resource type | Condition key | Associated operation |
---|---|---|---|---|
vpc:CreateDefaultVpc |
|
| none |
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
RegionId | string | Yes | The ID of the region to which the default VPC belongs. You can call the DescribeRegions operation to query the most recent region list. | cn-hangzhou |
Ipv6CidrBlock | string | No | The IPv6 CIDR block of the default VPC. Note
When EnableIpv6 is set to true, this parameter is required.
| 2408:XXXX:346:b600::/56 |
EnableIpv6 | boolean | No | Specifies whether to enable IPv6. Valid values:
| false |
ResourceGroupId | string | No | The ID of the resource group. | rg-acfmystnjq4**** |
ClientToken | string | No | 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.
| 123e4567-e89b-12d3-a456-426655440000 |
Response parameters
Examples
Sample success responses
JSON
format
{
"VpcId": "vpc-bp15zckdt37pq72zv****",
"VRouterId": "vrt-bp1lhl0taikrteen8****",
"RequestId": "0ED8D006-F706-4D23-88ED-E11ED28DCAC0",
"RouteTableId": "vtb-bp1q1uirugzb1x32m****"
}
Error codes
HTTP status code | Error code | Error message | Description |
---|---|---|---|
400 | TOKEN_PROCESSING | Action is processing. | - |
400 | InvokeError | instance quota rule invoke error. | Failed to get rule data, please wait zai shi |
400 | InvalidParameter | Specified CIDR block is not valid | The specified CIDR block is invalid. |
400 | ResourceNotAvailable | Resource you requested is not available in this region or zone. | You cannot create a vSwitch in the current region or zone. |
400 | InvalidVpcName.Malformed | Specified VPC name is not valid. | 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 format of the VPC description is invalid. |
400 | QuotaExceeded.Vpc | VPC quota exceeded. | 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 resource you requested is not available in this region or zone. |
400 | InvalidParameter | Specified UserCidr invalid format. | The format of the user CIDR block is invalid. |
400 | InvalidParameter | Specified UserCidr Subnet mask is not valid . | The subnet mask of the user CIDR block is invalid. |
400 | InvalidUserCidr.Quota | Specified UserCidr number is greater than 3. | 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 user CIDR block that you specify overlaps with 100.64.0.0/10. |
400 | InvalidResourceGroupId | The specified ResourceGroupId does not exist. | The specified resource group ID does not exist. |
400 | IllegalParam.Ipv6CidrBlock | %s | - |
400 | OperationFailed.IPv6CidrNotReserved | %s | - |
400 | MissingParam.EnableIpv6 | %s | - |
400 | OperationUnsupported.Ipv6Feature | %s | - |
400 | IllegalParam.ZoneId | %s | - |
400 | OperationFailed.DefaultVpcExist | %s | - |
400 | OperationFailed.DefaultVpcExist | A default VPC already exists in the region. | - |
403 | Forbbiden | User not authorized to operate on the specified resource. | User not authorized to operate on the specified resource. |
404 | InvalidRegionId.NotFound | Specified 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. |
500 | InternalError | The request processing has failed due to some unknown error. | An unknown error occurred. |
For a list of error codes, visit the Service error codes.