Updated on 2022-01-25 GMT+08:00

Creating a NAT Gateway

Function

This API is used to create a NAT gateway.

URI

POST /v2/{project_id}/nat_gateways

Table 1 Parameter description

Parameter

Mandatory

Type

Description

project_id

Yes

String

Specifies the project ID.

Request

Table 2 describes the request parameters.

Table 2 Request parameter

Parameter

Mandatory

Type

Description

nat_gateway

Yes

Object

Specifies the NAT gateway object. For details, see Table 3.

Table 3 Description of the nat_gateway field

Parameter

Mandatory

Type

Description

tenant_id

No

String

Specifies the project ID.

name

Yes

String(64)

Specifies the NAT gateway name.

The name can contain only digits, letters, underscores (_), and hyphens (-).

description

No

String(255)

Provides supplementary information about the NAT gateway.

spec

Yes

String

Specifies the NAT gateway type.

The value can be:

  • 1: small type, which supports up to 10,000 SNAT connections.
  • 2: medium type, which supports up to 50,000 SNAT connections.
  • 3: large type, which supports up to 200,000 SNAT connections.
  • 4: extra-large type, which supports up to 1,000,000 SNAT connections.

router_id

Yes

String

Specifies the VPC ID.

internal_network_id

Yes

String

Specifies the network ID of the downstream interface (the next hop of the DVR) of the NAT gateway.

enterprise_project_id

No

String

  • Specifies the enterprise project ID. When creating a NAT gateway, associate an enterprise project ID with the NAT gateway. The value 0 indicates the default enterprise project.
  • The value can contain a maximum of 36 characters. It is string "0" or in UUID format with hyphens (-).

Response

Table 4 lists response parameters.

Table 4 Response parameters

Parameter

Type

Description

nat_gateway

Object

Specifies the NAT gateway object. For details, see Table 5.

Table 5 Description of the nat_gateway field

Parameter

Type

Description

id

String

Specifies the NAT gateway ID.

tenant_id

String

Specifies the project ID.

name

String(64)

Specifies the NAT gateway name.

The name can contain only digits, letters, underscores (_), and hyphens (-).

description

String(255)

Provides supplementary information about the NAT gateway.

spec

String

Specifies the NAT gateway type.

The value can be:

  • 1: small type, which supports up to 10,000 SNAT connections.
  • 2: medium type, which supports up to 50,000 SNAT connections.
  • 3: large type, which supports up to 200,000 SNAT connections.
  • 4: extra-large type, which supports up to 1,000,000 SNAT connections.

router_id

String

Specifies the router UUID.

internal_network_id

String

Specifies the network ID of the downstream interface (the next hop of the DVR) of the NAT gateway.

status

String

  • Specifies the status of the NAT gateway.
  • For details about all its values, see Table 1.

admin_state_up

Boolean

  • Specifies the unfrozen or frozen state.
  • The value can be:
    • true: indicates the unfrozen state.
    • false: indicates the frozen state.

created_at

String

Specifies when the NAT gateway is created (UTC time). Its value rounds to 6 decimal places for seconds. The format is yyyy-mm-dd hh:mm:ss.

dnat_rules_limit

String

Specifies the maximum number of DNAT rules of a NAT gateway.

snat_rule_public_ip_limit

String

Specifies the maximum number of EIPs that can be bound to an SNAT rule of a NAT gateway.

billing_info

String

If the billing mode of a NAT gateway is Yearly/Monthly, the value indicates the order information. If the billing mode of a NAT gateway is Pay-per-use, the value is an empty string.

enterprise_project_id

String

  • Specifies the enterprise project ID. When creating a NAT gateway, associate an enterprise project ID with the NAT gateway. The value 0 indicates the default enterprise project.
  • The value can contain a maximum of 36 characters. It is string "0" or in UUID format with hyphens (-).

Examples

  • Example request
    POST https://{Endpoint}/v2/27e25061336f4af590faeabeb7fcd9a3/nat_gateways 
    { 
            "nat_gateway": { 
            "name": "nat_001", 
            "description": "my nat gateway 01", 
            "router_id": "d84f345c-80a1-4fa2-a39c-d0d397c3f09a", 
            "internal_network_id": "89d66639-aacb-4929-969d-07080b0f9fd9", 
            "spec": "1",
            "enterprise_project_id": "0aad99bc-f5f6-4f78-8404-c598d76b0ed2"
        } 
    }
  • Example response
    { 
        "nat_gateway": { 
            "router_id": "d84f345c-80a1-4fa2-a39c-d0d397c3f09a", 
            "status": "PENDING_CREATE", 
            "description": "my nat gateway 01", 
            "admin_state_up": true, 
            "tenant_id": "27e25061336f4af590faeabeb7fcd9a3", 
            "created_at": "2017-11-18 07:34:32.203044", 
            "spec": "1", 
            "internal_network_id": "89d66639-aacb-4929-969d-07080b0f9fd9", 
            "id": "a78fb3eb-1654-4710-8742-3fc49d5f04f8", 
            "name": "nat_001",
            "dnat_rules_limit": "200",
            "snat_rule_public_ip_limit": "20",
            "enterprise_project_id": "0aad99bc-f5f6-4f78-8404-c598d76b0ed2",
            "billing_info": ""
        } 
    }

Status Code

See Status Codes.