CreateVpc
CreateVpc
1. API Description
This API is used to create a VPC.
Prerequisites
Before creating a VPC, call DescribeVpcAvailableRegions
to check the availability regions for VPC creation.
Note
The quantity of VPCs you can create in one availability region is limited. If you need more, please contact Zenlayer Support.
This API is an async API. A VPC ID list is returned after the creation request is sent. However, it does not mean the creation has been completed. The status of the VPC will be
CREATING
during the creation. You can use DescribeVpcs to query the status of the VPC. If the status changes fromCREATING
toAVAILABLE
, it means that the VPC has been created successfully;CREATE_FAILED
means the VPC has been created failed. Any operations on the VPCs are not allowed while creating.
2. Input Parameters
The following request parameter list only provides API request parameters.
Parameter Name | Required | Type | Description |
---|---|---|---|
vpcRegionId | Yes | String | Availability region ID of VPC. |
cidrBlock | Yes | String | CIDR block of VPC. |
vpcName | Yes | String | VPC name to be displayed. This parameter can contain up to 64 characters. Only letters, numbers, - and periods (.) are supported. |
resourceGroupId | No | String | Resource group ID. If the value is not passed in, the VPC will be put into the default resource group. If no authorized default resource group found, the request will fail. |
3. Output Parameters
Parameter Name | Type | Description |
---|---|---|
requestId | String | The unique request ID, which is returned for each request. RequestId is required for locating a problem. |
vpcId | String | VPC ID. |
4. Code Example
Create a VPC in CHI1
.
5. Developer Resources
Zenlayer Cloud API 2.0 integrates SDKs to make it easier for you to call APIs. More programming languages will be supported.
6. Error Codes
The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.
HTTP Status Code | Error Code | Description |
---|---|---|
404 | INVALID_VPC_REGION_NOT_FOUND | Availability region not found. |
403 | OPERATION_DENIED_VPC_REGION_EXCEED_LIMIT | Quantity of VPCs exceeds the limit of the availability region. |
400 | INVALID_PARAMETER_VPC_LAN_IP_NETMASK | Invalid netmask of CIDR block. |
400 | INVALID_PARAMETER_VPC_CIDR_BLOCK | Invalid CIDR block. |
400 | INVALID_PARAMETER_VPC_LAN_IP | Only CIDR block with private IP range is supported. |
Last updated