You need to enable JavaScript to run this app.
导航
创建SNAT规则
最近更新时间:2025.09.17 17:15:28首次发布时间:2025.09.17 17:15:28
复制全文
我的收藏
有用
有用
无用
无用

本接口用于在 NAT 网关下创建 SNAT 规则。

使用说明

前提条件:

  • 已创建 NAT 网关并为 NAT 网关绑定了弹性公网 IP。
  • 边缘实例所在子网的路由表中,存在一条将下一跳指定为该 NAT 网关的路由条目。

使用限制:
SNAT 规则和 DNAT 规则不能绑定相同的弹性公网 IP。

请求说明

  • 请求方式:POST
  • 请求地址:https://veenedge.volcengineapi.com/?Action=CreateSNatRule&Version=2021-04-30

请求参数

下表列出了接口特定的请求参数以及公共请求参数 Action 和 Version。 其他公共参数,请参见公共参数

Query

参数
类型
是否必选
示例值
描述
Action
String
CreateSNatRule
接口名称。当前 API 的名称为 CreateSNatRule
Version
String
2021-04-30
接口版本。当前 API 的版本为 2021-04-30

Body

参数
类型
是否必选
示例值
描述
natgw_identity
String
natgw-xf6lpcbnxbl****
NAT 网关的 ID。您可以调用 ListNatGateways 接口查询 NAT 网关的 ID。
rule_name
String
snat_01

SNAT 规则的名称。命名规则如下:

  • 允许 5~20 个字符。
  • 允许汉字、大写字母、小写字母、数字和以下特殊字符:()`~!@#$%^&*-+=_|{}[]:;'<>,.?/。
  • 不能包含空格,且不能以正斜线(/)开头。
backend_type
String
vpc

SNAT 规则的作用范围。取值范围:

  • vpc:私有网络。该参数值表示 SNAT 规则作用于 NAT 网关所在的整个私有网络内的边缘实例。
eip_list
String[]
["eip-d7ztfw****"]
弹性公网 IP 的 ID 列表。您可以调用 ListEipsOfNatGateway 接口查询 NAT 网关绑定的弹性公网 IP 的 ID。

返回参数

下表仅列出本接口特有的返回参数。更多信息请参见返回结果

参数
类型
示例值
描述
snat_rule_identity
String
snatrule-gbr745k9g75****
SNAT 规则的 ID。

请求示例

POST https://veenedge.volcengineapi.com/?Action=CreateSNatRule&Version=2021-04-30
<其他公共参数>
{
    "natgw_identity": "natgw-xf6lpcbnxbl****",
    "rule_name": "snat_01",
    "backend_type": "vpc",
    "eip_list": [
        "eip-9kn9mx****"
    ]
}

返回示例

{
    "ResponseMetadata": {
        "RequestId": "2025091516270333A1AB3EAC480F54****",
        "Action": "CreateSNatRule",
        "Version": "2021-04-30",
        "Service": "veenedge",
        "Region": "cn-north-1"
    },
    "Result": {
        "snat_rule_identity": "snatrule-gbr745k9g75****"
    }
}

错误码

如果响应正文中包含 Error 字段,则表示 API 请求失败。关于错误码的更多信息,参见错误码