Create SNAT rules
Updated at:2025-10-16
Create SNAT rules
Description
Set up SNAT rules for the NAT gateway.
Request structure
Plain Text
1POST /v{version}/nat/{natId}/snatRule?clientToken={clientToken} HTTP/1.1
2Host: bcc.bj.baidubce.com
3Authorization: authorization string
4{
5 "ruleName":"test",
6 "publicIpsAddress":["100.88.14.90"],
7 "sourceCIDR":"192.168.1.0/24"
8}
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) |
| natId | String | Yes | URL parameter | NAT gateway ID |
| ruleName | String | Yes | RequestBody | Name, which supports uppercase and lowercase letters, numbers, and special characters such as-, , _, / and., starting with a letter, with a length of 1-65. |
| publicIpsAddress | List |
Yes | RequestBody | Public IPs: EIPs or IPs from EIPGROUP associated with the snatEips or bindEips of the NAT gateway |
| sourceCIDR | String | Yes | RequestBody | Intranet IP/network segment |
Response headers
No special headers are required beyond the standard ones.
Response parameters
| Parameter name | Types | Description |
|---|---|---|
| ruleId | String | ID of the created SNAT rule |
Request example
Plain Text
1POST /v1/nat/nat-brkztytqzbh0/snatRule?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/74c506f68c65e26c633bfa104c863fffac5190fdepublicIpsAddressc1ec24b7c03eb5d67d2e1de
5{
6 "ruleName":"test",
7 "publicIpsAddress":"100.88.14.90",
8 "sourceCIDR":"192.168.1.0/24"
9}
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 "ruleId": "rule-zrsaybxm7nrn"
8}
