edit-icon download-icon

CreateNatGateway

Last Updated: Apr 09, 2018

Description

Create a NAT Gateway.

Note the following before creating a NAT Gateway:

  • A NAT Gateway and a self-built SNAT Gateway cannot coexist in a VPC.

  • If a route entry of which the destination CIDR block is 0.0.0.0/0 already exists in the route table of the VPC, delete the router entry.

  • After a NAT Gateway is created, a route entry of which the destination CIDR block is 0.0.0.0/0 and the next hop is the NAT Gateway is automatically added to the route table of the VPC. Therefore, traffic can be routed to the NAT Gateway.

Specification

The NAT Gateway has different specifications. Different specifications correspond to different SNAT performance metrics including Max Connection and CPS, but the specification does not affect data throughput.

The following table lists available NAT Gateway specifications:

Specification Max Connection CPS
Small 10,000 1,000
Medium 50,000 5,000
Large 200,000 10,000

Request parameters

Name Type Required Description
Action String Yes

The action to perform.

Valid value: CreateNatGateway

RegionId String Yes

The region of the NAT Gateway.

You can obtain the region ID by calling the DescribeRegions API.

VpcId String Yes The ID of the VPC to which the NAT Gateway belongs.
Spec String No

The specification of the NAT Gateway. Valid value:

  • Small (Default)

  • Middle

  • Large

Name String No

The name of the NAT Gateway.

The name must start with an English letter, but cannot start withhttp:// or https://.

The name can contain from 2 to 128 characters including a-z, A-Z, 0-9, underlines, and hyphens.

/td>
Description String No

The description of the NAT Gateway.

The description must start with English letters, but cannot start with http:// or https://.

The description can contain from 2 to 256 characters.

ClientToken String No

A client token used to guarantee the idempotence of requests. This parameter value is generated by the client and must be unique. It cannot exceed 64 ASCII characters.

For more information, see How to ensure idempotence.

Response parameters

Name Type Description
RequestId String The ID of the request.
NatGatewayId String

The ID of the NAT Gateway.

ForwardTableIds Array The list of forwarding entries.

Error codes

See VPC API Error Center.

Examples

Request example

  1. https://vpc.aliyuncs.com/?Action=CreateNatGateway
  2. &VpcId=vpc-11af8lp67
  3. &Name=MyNatGW
  4. &RegionId=cn-shanghai
  5. &Description=My+first+NAT+Gateway
  6. <CommonParameters>

Response example

JSON format

  1. {
  2. "ForwardTableIds": {
  3. "ForwardTableId": [
  4. "ftb-11tc6xgmv"
  5. ]
  6. },
  7. "NatGatewayId": "ngw-112za33e4",
  8. "RequestId": "2315DEB7-5E92-423A-91F7-4C1EC9AD97C3"
  9. }
Thank you! We've received your feedback.