CreateNatGateway

1. API Description

This API is used to create a NAT gateway.

Note

  • This API is an async API. A response is returned after the request is sent. You can call DescribeNatGateways to query the state of the NAT gateway. The RUNNING state means creating successfully.

  • Only pay-as-you-go NAT gateway creation is supported.

2. Input Parameters

The following request parameter list only provides API request parameters.

Parameter Name
Required
Type
Description

regionId

Yes

String

Region ID.

vpcId

Yes

String

VPC network ID to which the NAT gateway belongs.

name

Yes

String

The name of the NAT gateway.

Length must be between 2 and 63 characters.

Available range: [2.0, +).

subnetIds

No

Array of String

Subnet ID list to which the NAT gateway belongs.

resourceGroupId

No

String

Resource Group ID

If not specified, it will belong to the default resource group.

3. Output Parameters

Parameter Name
Type
Description

requestId

String

The unique request ID, which is returned for each request.

RequestId is required to locate a problem.

orderNumber

String

Order number.

natGatewayId

String

The unique ID of the NAT gateway.

4. Code Example

Create a NAT gateway.

POST /api/v2/zec HTTP/1.1
Host: console.zenlayer.com
Content-Type: application/json
X-ZC-Action: CreateNatGateway
<Common Request Params>

Request:
{
    "regionId": "asia-east-1",
    "vpcId": "<vpcId>",
    "name": "name",
    "subnetIds": ["<subnet>", "<subnet>"],
    "resourceGroupId": "<resourceGroupId>"
}

Response:
{
  "requestId": "T05992D0C-7E8B-4047-B0C0-780F2CD549D3",
  "response": {
    "requestId": "T05992D0C-7E8B-4047-B0C0-780F2CD549D3",
    "orderNumber": "<orderNumber>",
    "natGatewayId": "<natGatewayId>"
  }
}

5. Developer Resources

Zenlayer Cloud API 2.0 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_REGION_NOT_FOUND

Region does not exist.

404

INVALID_VPC_NOT_FOUND

VPC does not exist.

404

INVALID_SUBNET_NOT_FOUND

Subnet is not found.

400

OPERATION_DENIED_NAT_SUBNET_CONFLICT

Subnet is associated already

400

OPERATION_DENIED_SUBNET_STATUS

Subnet state is not supported.

400

OPERATION_DENIED_SUBNET_NAT_CONFLICT

Subnet is associated with a NAT gateway already.

404

INVALID_EIP_NOT_FOUND

The elastic IP is not found.

400

OPERATION_DENIED_EIP_IS_NOT_UN_ASSIGN

The state of the elastic IP is bound already.

400

OPERATION_DENIED_SNAT_ENTRY_COUNT_LIMIT

The number of SNAT entries is limited.

400

OPERATION_DENIED_DNAT_ENTRY_COUNT_LIMIT

The number of DNAT entries is limited.

Last updated