Create NAT gateway
Updated at:2025-10-16
Description
Create NAT gateway
- Only one EIP can be bound, whereas multiple IPs can be bound to an EIPGROUP
Request structure
Plain Text
1POST /v{version}/nat?clientToken={clientToken} HTTP/1.1
2Host: bcc.bj.baidubce.com
3Authorization: authorization string
4{
5 "name": name,
6 "vpcId": vpcId,
7 "spec":spec,
8 "eips": [eips],
9 "dnatEips":[dnatEips],
10 "billing": {
11 "paymentTiming": paymentTiming,
12 "reservation": {
13 "reservationLength": reservationLength,
14 "reservationTimeUnit": reservationTimeUnit
15 }
16 },
17 "tags":[
18 {
19 "tagKey": tagKey,
20 "tagValue": tagValue
21 }
22 ],
23 "resourceGroupId": resourceGroupId,
24 "deleteProtect":deleteProtect
25}
Request headers
There are no special headers required beyond the common headers.
Request parameters
| Parameter name | Types | Whether required | Parameter location | Description |
|---|---|---|---|---|
| version | String | Yes | URL parameter | API version number, current value is 1. |
| clientToken | String | Yes | Query | Idempotence token, which is an ASCII string with a length not exceeding 64 bits, see details in [ClientToken Idempotence Support](VPC/API Reference/General Description.md) |
| name | String | Yes | RequestBody | NAT gateway name, which supports uppercase and lowercase letters, numbers, and special characters such as -, , _, / and ., starting with a letter, with a length of 1-65. |
| vpcId | String | Yes | RequestBody | VPC ID |
| spec | String | Yes | RequestBody | NAT gateway sizes include small (supporting up to 5 public IPs), medium (supporting up to 10 public IPs), and large (supporting up to 15 public IPs). Select this parameter or cuNum. Applicable only to standard NAT gateways |
| cuNum | Integer | Yes | RequestBody | NAT gateway CU count (mutually exclusive with spec, applicable only to enhanced NAT gateway) |
| eips | List | No | RequestBody | Associate the EIP in NAT gateway or one or more EIPs in EIPGROUP |
| dnatEips | List | No | RequestBody | Associate the DNAT in NAT gateway or one or more EIPs in EIPGROUP |
| bindEips | List | No | RequestBody | Associate the EIP in NAT gateway or one or more EIPs in EIPGROUP, applicable only to enhanced NAT gateway |
| billing | [Billing](VPC/API Reference/Appendix.md#billing) | Yes | RequestBody | Billing information |
| tags | List<[TagModel](VPC/API Reference/Appendix.md#tagmodel)> | No | RequestBody | List of tag key-value pairs to be created. |
| resourceGroupId | String | No | RequestBody | Resource group |
| deleteProtect | Boolean | No | RequestBody | Option to enable release protection. By default, it is set to false, allowing deletion. |
Response headers
No special headers are required beyond the standard ones.
Response parameters
| Parameter name | Types | Description |
|---|---|---|
| natId | String | ID of the created NAT |
Request example - prepay
Plain Text
1POST /v1/nat?clientToken=be31b98c-5e41-4838-9830-9be700de5a20 HTTP/1.1
2Host: bcc.bj.baidubce.com
3ContentType: application/json
4Authorization: bce-auth-v1/f81d3b34e48048fbb2634dc7882d7e21/2018-07-05T04:17:29Z/3600/ host/74c506f68c65e26c633bfa104c863fffac5190fdec1ec24b7c03eb5d67d2e1de
5
6{
7 "name":"nat1",
8 "vpcId":"vpc-a4sg6vsfzbra",
9 "spec":"small",
10 "eips":[
11 "10.107.247.192"
12 ],
13 "dnatEips":[
14 "100.88.14.90"
15 ],
16 "billing":{
17 "reservation":{
18 "reservationLength":1,
19 "reservationTimeUnit":"month"
20 },
21 "paymentTiming":"Prepaid"
22 },
23 "tags":[
24 {
25 "tagKey": "tagKey",
26 "tagValue": "tagValue"
27 }
28 ],
29 "resourceGroupId": "RESG-UoMgbkuLNjj",
30 "deleteProtect": true
31}
Request example - postpay
Plain Text
1POST /v1/nat?clientToken=be31b98c-5e41-4838-9830-9be700de5a20 HTTP/1.1
2Host: bcc.bj.baidubce.com
3ContentType: application/json
4Authorization: bce-auth-v1/f81d3b34e48048fbb2634dc7882d7e21/2018-07-05T04:17:29Z/3600/ host/74c506f68c65e26c633bfa104c863fffac5190fdec1ec24b7c03eb5d67d2e1de
5
6{
7 "name":"nat1",
8 "vpcId":"vpc-a4sg6vsfzbra",
9 "spec":"small",
10 "billing":{
11 "paymentTiming":"Postpaid"
12 },
13 "tags":[
14 {
15 "tagKey": "tagKey",
16 "tagValue": "tagValue"
17 }
18 ],
19 "resourceGroupId": "RESG-UoMgbkuLNjj",
20 "deleteProtect": true
21}
Response example
Plain Text
1HTTP/1.1 200 OK
2x-bce-request-id: 1214cca7-4ad5-451d-9215-71cb844c0a50
3Date: Fri, 06 July 2018 07:06:06 GMT
4Content-Type: application/json;charset=UTF-8
5Server: BWS
6
7{
8 "natId": "nat-b58rnkn1g98h"
9}
