• Virtual Private Cloud

vpc
  1. Help Center
  2. Virtual Private Cloud
  3. API Reference
  4. APIs
  5. Virtual Private Cloud
  6. Creating a VPC

Creating a VPC

Function

This interface is used to create a VPC.

URI

POST /v1/{project_id}/vpcs
Table 1 Parameter description

Name

Mandatory

Description

project_id

Yes

Specifies the project ID.

Request Message

  • Request parameter
    Table 2 Request parameter

    Name

    Mandatory

    Type

    Description

    vpc

    Yes

    Dictionary data structure

    Specifies the VPC object.

    Table 3 Description of the vpc field

    Name

    Mandatory

    Type

    Description

    name

    No

    String

    • Specifies the VPC name.
    • The value is a string of no more than 64 characters that can contain letters, digits, underscores (_), hyphens (-), and periods (.).
    • Each VPC name of a tenant must be unique if the VPC name is not left blank.

    cidr

    No

    String

    • Specifies the available IP address ranges for subnets in the VPC.
    • The value ranges from 10.0.0.0/8 to 10.255.255.240/28, 172.16.0.0/12 to 172.31.255.240/28, or 192.168.0.0/16 to 192.168.255.240/28.
    • The value must be in CIDR format, for example, 192.168.0.0/16.
  • Example request
    {
        "vpc": {
            "name": "vpc",
            "cidr": "192.168.0.0/16"
          
        }
    }

Response Message

  • Response parameter
    Table 4 Response parameter

    Name

    Type

    Description

    vpc

    Dictionary data structure

    Specifies the VPC object.

    Table 5 Description of the vpc field

    Name

    Type

    Description

    id

    String

    Specifies a resource ID in UUID format.

    name

    String

    • Specifies the VPC name.
    • The value is a string of no more than 64 characters that can contain letters, digits, underscores (_), hyphens (-), and periods (.).
    • Each VPC name of a tenant must be unique if the VPC name is not left blank.

    cidr

    String

    • Specifies the available IP address ranges for subnets in the VPC.
    • The value ranges from 10.0.0.0/8 to 10.255.255.240/28, 172.16.0.0/12 to 172.31.255.240/28, or 192.168.0.0/16 to 192.168.255.240/28.
    • The value must be in CIDR format, for example, 192.168.0.0/16.

    status

    String

    • Specifies the VPC status.
    • The value can be CREATING (creating) or OK (successfully created).

    routes

    List

    • Specifies the route information.
    • For details, see the description of the route object.
    Table 6 Description of the route field

    Name

    Type

    Description

    destination

    String

    • Specifies the destination network segment of a route.
    • The value must be in the CIDR format. Currently, only the value 0.0.0.0/0 is supported.

    nexthop

    String

    • Specifies the next hop of a route.
    • The value must be an IP address and must belong to the subnet in the VPC. Otherwise, this value does not take effect.
  • Example response
    {
     "vpc": 
         {
         "id": "99d9d709-8478-4b46-9f3f-2206b1023fd3",
         "name": "vpc",
         "cidr": "192.168.0.0/16",
         "status": "CREATING",
         
         "routes": null
         }
    }

Status Codes

For details, see section Status Codes.

Error Codes

For details, see section Error Codes.