Creating a Public NAT Gateway¶
Scenarios¶
You can create a public NAT gateway to enable your servers to access the Internet or provide services accessible from the Internet.
Prerequisites¶
The VPC and subnet where you will create a public NAT gateway are available.
Traffic to the public NAT gateway needs to be allowed to pass through, that is, a route pointing to the public NAT gateway needs to be configured in the VPC. Therefore, when you create a public NAT gateway, a default route 0.0.0.0/0 that points to the public NAT gateway is automatically added to the default route table of the VPC. If the default route 0.0.0.0/0 already exists in the default route table of the VPC before you create the public NAT gateway, the default route that points to the public NAT gateway will fail to be added automatically. In this case, you need to perform the following operations after the public NAT gateway is successfully created: Manually add a different route that points to the gateway or create a default route 0.0.0.0/0 pointing to the gateway in the new routing table.
Procedure¶
Log in to the management console.
Click Service List in the upper left corner. Under Network, select NAT Gateway.
The Public NAT Gateway page is displayed.
On the displayed page, click CreatePublic NAT Gateway.
Configure the required parameters. For details, see Table 1.
¶ Parameter
Description
Region
The region where the public NAT gateway is located
Name
The name of the public NAT gateway
Enter up to 64 characters. Only digits, letters, underscores (_), and hyphens (-) are allowed.
VPC
The VPC that the public NAT gateway belongs to
The selected VPC cannot be changed after you create the public NAT gateway.
Note
Traffic to the public NAT gateway needs to be allowed to pass through, that is, a route pointing to the public NAT gateway needs to be configured in the VPC. Therefore, when you create a public NAT gateway, a default route 0.0.0.0/0 that points to the public NAT gateway is automatically added to the default route table of the VPC. If the default route 0.0.0.0/0 already exists in the default route table of the VPC before you create the public NAT gateway, the default route that points to the public NAT gateway will fail to be added automatically. In this case, you need to perform the following operations after the public NAT gateway is successfully created: Manually add a different route that points to the gateway or create a default route 0.0.0.0/0 pointing to the gateway in the new routing table.
Subnet
The subnet of the VPC that the public NAT gateway belongs to
The subnet must have at least one available IP address.
The selected subnet cannot be changed after you create the public NAT gateway.
Type
The type of the public NAT gateway
The type can be Extra-large, Large, Medium, and Small. You can click Learn more on the page to view details about each type.
Description
Supplementary information about the public NAT gateway
Enter up to 255 characters.
Tag
The public NAT gateway tag. A tag is a key-value pair.
You can add up to 10 tags to each public NAT gateway.
The tag key and value must meet the requirements listed in Table 2.
¶ Parameter
Requirement
Key
Cannot be left blank.
Must be unique for each NAT gateway.
Can contain a maximum of 36 characters.
Can contain only the following character types:
Letters
Digits
Special characters, including hyphens (-) and underscores (_)
Value
Can contain a maximum of 43 characters.
Can contain only the following character types:
Letters
Digits
Special characters, including hyphens (-) and underscores (_)
Click Create Now. On the page displayed, confirm the public NAT gateway specifications.
Click Submit to create a public NAT gateway.
It takes 1 to 5 minutes to create a public NAT gateway.
In the list, view the status of the public NAT gateway.
After the public NAT gateway is created, check whether a default route (0.0.0.0/0) that points to the public NAT gateway exists in the default route table of the VPC where the public NAT gateway is. If no, add a route pointing to the public NAT gateway to the default route table, alternatively, create a custom route table and add the default route 0.0.0.0/0 pointing to the public NAT gateway to the table. The following describes how to add a route to a custom route table.
Adding a Default Route Pointing to the Public NAT Gateway¶
Log in to the management console.
Under Network, select Virtual Private Cloud.
In the navigation pane on the left, choose Route Tables.
On the Route Tables page, click Create Route Table in the upper right corner.
VPC: Select the VPC to which the public NAT gateway belongs.
After the custom route table is created, click its name.
The Summary page is displayed.
Click Add Route and configure parameters as follows:
Destination: Set it to 0.0.0.0/0.
Next Hop Type: Select NAT gateway.
Next Hop: Select the created NAT gateway.
Click OK.