Creates a virtual private cloud (VPC).
Operation description
When you call this operation, take note of the following items:
-
You can specify only one CIDR block for each VPC.
-
After you create a VPC, you cannot change its CIDR block. However, you can add secondary IPv4 CIDR blocks to the VPC.
-
In each VPC, cloud services can use a maximum of 60,000 private IP addresses. You cannot increase the quota.
-
After you create a VPC, a vRouter and a route table are automatically created.
-
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 both 10.0.0.0/8 and 10.1.0.0/16 are specified, only 10.0.0.0/8 takes effect.
-
CreateVpc 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 VPC is in the Creating state, the VPC is being created.
- If the VPC is in the Created state, the VPC is created.
-
You cannot repeatedly call the DeleteRouteEntry operation to create default VPCs within a specific time period. However, you can repeatedly call this operation to create custom VPCs within a specific time period.
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:CreateVpc | create | *VPC acs:vpc:{#regionId}:{#accountId}:vpc/* |
| none |
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
RegionId | string | Yes | The ID of the region to which the VPC belongs. You can call the DescribeRegions operation to query the most recent region list. | cn-hangzhou |
CidrBlock | string | No | The CIDR block of the VPC.
| 172.16.0.0/12 |
Ipv6CidrBlock | string | No | The IPv6 CIDR block of the VPC. | 2408:XXXX:0:6a::/56 |
VpcName | string | No | The name of the VPC. The name must be 1 to 128 characters in length and cannot start with | abc |
EnableIpv6 | boolean | No | Specifies whether to enable IPv6. Valid values:
| false |
Description | string | No | The description of the VPC. The description must be 1 to 256 characters in length and cannot start with | This is my first Vpc |
ResourceGroupId | string | No | The ID of the resource group. For more information about resource groups, see What is a resource group? | rg-acfmxazb4ph6aiy**** |
Tag | array<object> | No | The tag of the resource. | |
object | No | |||
Key | string | No | The key of tag N to add to the resource. You can specify at most 20 tag keys. The tag key cannot be an empty string. The tag key can be at most 128 characters in length. It cannot start with | FinanceDept |
Value | string | No | The value of tag N to add to the resource. You can specify at most 20 tag values. The tag value can be an empty string. The tag value can be up to 128 characters in length, but cannot contain | FinanceJoshua |
DryRun | boolean | No | Specifies whether to perform a dry run, without performing the actual request. Valid values:
| false |
UserCidr | string | No | The user CIDR block. Separate user CIDR blocks with commas (,). You can specify up to three user CIDR blocks. For more information about user CIDR blocks, see the | 192.168.0.0/12 |
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 |
Ipv6Isp | string | No | The type of the IPv6 CIDR block of the VPC. Valid values:
Note
If you are allowed to use single-ISP bandwidth, you can set the value to ChinaTelecom, ChinaUnicom, or ChinaMobile.
| BGP |
Ipv4IpamPoolId | string | No | The ID of the IP Address Manager (IPAM) pool of the IPv4 type. | ipam-pool-sycmt3p2a9v63i**** |
Response parameters
Examples
Sample success responses
JSON
format
{
"VpcId": "vpc-bp15zckdt37pq72zv****",
"VRouterId": "vrt-bp1lhl0taikrteen8****",
"RequestId": "0ED8D006-F706-4D23-88ED-E11ED28DCAC0",
"RouteTableId": "vtb-bp145q7glnuzdv****",
"ResourceGroupId": "rg-acfmxazb4ph6aiy****"
}
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 | System.ServiceBusy | System is busy, please try later. | - |
400 | IllegalParam.UserCidr | UserCidr is not a valid or strict address. | UserCidr is illegal. |
400 | OperationUnsupported.ResourceGroupId | ResourceGroup is not supported in this region. | - |
400 | IllegalParam.UserCidr | %s | - |
400 | IllegalParam.EnableIpv6 | %s | - |
400 | InvalidIpv6CidrBlock.Malformed | Specified Ipv6CidrBlock is not valid. | - |
400 | UnsupportedFeature.Ipv6Isp | The Ipv6Isp feature is not supported. | The specified IPv6 ISP is not supported. |
400 | ResourceNotEnough.Ipv6Cidr | The specified resource of Ipv6Cidr is not enough. | IPv6 addresses are insufficient. |
400 | UnsupportedFeature.IPAM | VPCs cannot be created by using IPAM. | You cannot use IPAM to create a VPC. |
400 | OperationUnsupported.Ipv6Feature | The IPv6 feature is not supported in the region. | This region does not support IPv6. |
403 | Forbidden | User not authorized to operate on the specified resource. | You do not have the permissions to manage the specified resource. Apply for the permissions and try again. |
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.
Change history
Change time | Summary of changes | Operation |
---|---|---|
2024-10-10 | The Error code has changed. The request parameters of the API has changed | View Change Details |
2024-08-27 | The Error code has changed. The request parameters of the API has changed | View Change Details |
2024-05-21 | The Error code has changed | View Change Details |
2024-05-17 | The Error code has changed | View Change Details |
2024-04-25 | The Error code has changed. The request parameters of the API has changed | View Change Details |
2023-09-21 | API Description Update. The Error code has changed | View Change Details |
2023-07-05 | The Error code has changed. The request parameters of the API has changed | View Change Details |
2023-06-13 | The Error code has changed | View Change Details |
2023-04-26 | The Error code has changed | View Change Details |
2023-04-13 | The Error code has changed. The request parameters of the API has changed | View Change Details |