Create SNAT rules in batches
Updated at:2025-10-16
Create SNAT rules in batches
Description
Create SNAT rules for the NAT gateway in batches
Request structure
Plain Text
1POST /v{version}/nat/snatRule/batchCreate?clientToken={clientToken} HTTP/1.1
2Host: bcc.bj.baidubce.com
3Authorization: authorization string
4{
5 "natId": "nat-bzawefgr3mg4",
6 "snatRules": [
7 {
8 "ruleName":"test1",
9 "publicIpsAddress":["100.88.14.90"],
10 "sourceCIDR": "192.168.16.0/20"
11 },
12 {
13 "ruleName":"test2",
14 "publicIpsAddress":["100.88.14.90"],
15 "sourceCIDR": "192.168.1.0/24"
16 }
17 ]
18}
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 | RequestBody | NAT gateway ID |
| snatRules | List<[SnatRuleRequest](VPC/API Reference/Appendix.md#SnatRuleRequest)> | Yes | RequestBody | Intranet IP/network segment |
Response headers
No special headers are required beyond the standard ones.
Response parameters
| Parameter name | Types | Description |
|---|---|---|
| snatRuleIds | List |
Collection of IDs of the created SNAT rules |
Request example
Plain Text
1POST /v1/nat/snatRule/batchCreate?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 "natId": "nat-bzawefgr3mg4",
7 "snatRules": [
8 {
9 "ruleName":"test1",
10 "publicIpsAddress":["100.88.14.90"],
11 "sourceCIDR": "192.168.16.0/20"
12 },
13 {
14 "ruleName":"test2",
15 "publicIpsAddress":["100.88.14.90"],
16 "sourceCIDR": "192.168.1.0/24"
17 }
18 ]
19}
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 "snatRuleIds": [
8 "rule-zrsaybxm7nrn",
9 "rule-f5kid5g50nua"
10 ]
11}
