Updated on 2025-08-19 GMT+08:00

Creating a P2C VPN Gateway

Function

This API is used to create a P2C VPN gateway.

Calling Method

For details, see Calling APIs.

URI

POST /v5/{project_id}/p2c-vpn-gateways

Table 1 Parameter description

Parameter

Type

Mandatory

Description

project_id

String

Yes

Specifies a project ID. You can obtain the project ID by referring to Obtaining the Project ID.

Request

  • Request parameters
    Table 2 Request parameters

    Parameter

    Type

    Mandatory

    Description

    p2c_vpn_gateway

    CreateP2cVgwRequestBodyContent

    object

    Yes

    Specifies the P2C VPN gateway object.

    Table 3 CreateP2cVgwRequestBodyContent

    Parameter

    Type

    Mandatory

    Description

    name

    String

    No

    • Specifies the name of a P2C VPN gateway.
    • The value is a string of 1 to 64 characters, which can contain digits, letters, underscores (_), and hyphens (-).

    vpc_id

    String

    Yes

    • Specifies the ID of the VPC to which the P2C VPN gateway belongs.
    • The value is a UUID containing 36 characters.

    connect_subnet

    String

    Yes

    • Specifies the ID of the VPC subnet used by the P2C VPN gateway.
    • The value is a UUID containing 36 characters.

    flavor

    String

    No

    • Specifies the specification of the P2C VPN gateway.
    • Value range:

      Professional1

    • The default value is Professional1.

    availability_zone_ids

    Array of String

    No

    • Specifies the AZ where the P2C VPN gateway is to be deployed. If this parameter is not specified, one or two AZs are automatically selected for the P2C VPN gateway.
    • Constraints: If two or more AZs are supported for the P2C VPN gateway, specify two AZs. If only one AZ is supported for the P2C VPN gateway, specify one AZ. If no AZ is supported, the P2C VPN gateway cannot be created.

    eip

    CreateRequestEip object

    Yes

    • Specifies the EIP used by the P2C VPN gateway.

    tags

    Array of Tag object

    No

    • Specifies a tag list.
    • A maximum of 20 tags can be specified.
    Table 4 CreateRequestEip

    Parameter

    Type

    Mandatory

    Description

    id

    String

    No

    • Specifies an EIP ID.
    • The value is a UUID containing 36 characters.
    • Set this parameter only when an existing EIP is used.

    You can obtain the EIP ID by referring to Querying EIPs.

    type

    String

    No

    • Specifies the EIP type.
    • The value is a string of 0 to 36 characters.

      For the value range, see the type field in Table 6 in Assigning an EIP. The value 5_bgp is preferred if it is supported.

    • Set this parameter only when a new EIP is used.

      For more constraints, see the type field in Table 3 in Assigning an EIP.

    charge_mode

    String

    No

    • Specifies the billing mode of EIP bandwidth.
    • Value range:

      bandwidth: billed by bandwidth

      traffic: billed by traffic

    • This parameter is mandatory only when a new EIP not binding to shared bandwidth is created.
    • The default value is bandwidth.

    bandwidth_size

    Integer

    No

    • Specifies the bandwidth (Mbit/s) of an EIP. The maximum EIP bandwidth varies according to regions and depends on the EIP service. You can submit a service ticket to increase the maximum EIP bandwidth under your account.
    • The value ranges from 1 to 300. For details, see the EIP documentation.
    • This parameter is mandatory only when a new EIP not binding to shared bandwidth is created.

    bandwidth_name

    String

    No

    • Specifies an EIP bandwidth name.
    • The value is a string of 1 to 64 characters, which can contain digits, letters, underscores (_), hyphens (-), and periods (.).
    • Set this parameter only when a new EIP is used.
    • When a new EIP is used and this parameter is not set, an EIP bandwidth name in the format of p2c-vpngw-bandwidth-**** is automatically generated, for example, p2c-vpngw-bandwidth-e5b4.
    Table 5 Tag

    Parameter

    Type

    Mandatory

    Description

    key

    String

    Yes

    • Specifies a tag key.
    • The value is a string of 1 to 128 characters that can contain digits, letters, Spanish characters, Portuguese characters, spaces, and special characters (_ . : = + - @).

    value

    String

    Yes

    • Specifies a tag value.
    • The value is a string of 0 to 255 characters that can contain digits, letters, Spanish characters, Portuguese characters, spaces, and special characters (_ . : = + - @).
  • Example request
    POST https://{Endpoint}/v5/{project_id}/p2c-vpn-gateways
    
    {
      "p2c_vpn_gateway": {
        "name": "p2c-vpngw-0003",
        "vpc_id": "d9d85143-e1e1-427a-9994-d8b8fd9ebe3f",
        "availability_zone_ids": ["cn-north-7a", "cn-north-7b"],
        "connect_subnet": "2d1da07b-861d-447d-8233-1aff4d767825",
        "eip": {
           "bandwidth_name": "",
           "bandwidth_size": 10,
           "type": "5_bgp"     
        },
        "flavor": "Professional1"
      }
    }

Response

  • Response parameters

    Returned status code 201: successful operation

    Table 6 Parameters in the response body

    Parameter

    Type

    Description

    p2c_vpn_gateway

    ResponseP2cVgw object

    Specifies the P2C VPN gateway object.

    request_id

    String

    Specifies a request ID.

    Table 7 ResponseP2cVgw

    Parameter

    Type

    Description

    id

    String

    • Specifies the ID of a P2C VPN gateway.
    • The value is a UUID containing 36 characters.
  • Example response
    {
        "p2c_vpn_gateway": {
            "id": "10d176c7-aed8-4766-9180-a47e536c64d0"
        },
        "request_id": "b19ba5a0be8f7b7f664b14596f8f35db"
    }

Status Codes

For details, see Status Codes.