全部产品
Search
文档中心

NAT 网关:ModifyNatGatewayAttribute - 修改NAT网关的属性

更新时间:Aug 27, 2026

调用ModifyNatGatewayAttribute接口修改NAT网关的属性。

接口说明

本接口查询的 NAT 网关包括公网 NAT 网关和 VPC NAT 网关,文中出现的“NAT 网关”不做具体的区分。

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

调试

授权信息

当前API暂无授权信息透出。

请求参数

名称

类型

必填

描述

示例值

RegionId

string

是

要修改的 NAT 网关所在的地域 ID。

您可以通过调用 DescribeRegions 接口获取地域 ID。

cn-hangzhou

NatGatewayId

string

是

要修改的 NAT 网关的 ID。

ngw-2ze0dcn4mq31qx2jc****

Name

string

否

要修改的 NAT 网关名称。

名称长度为 1~128 个字符,不能以http://或https://开头。

nat123

Description

string

否

要修改的 NAT 网关描述信息。

描述长度为 1~128 个字符,不能以http://或https://开头。

Description

IcmpReplyEnabled

boolean

否

是否开启 ICMP 代回。取值:

  • true(默认值):开启。

  • false:不开启。

true

EipBindMode

string

否

修改 NAT 网关的 EIP 绑定模式。取值:可以为空,非空时只允许为 NAT,表示绑定模式为 EIP 普通模式。

说明
  • 只支持将MULTI_BINDED模式修改为 NAT 模式,不支持将 NAT 模式修改为MULTI_BINDED模式。关于MULTI_BINDED模式的具体信息,请参见 CreateNatGateway 。

  • 在 EIP 绑定模式切换过程中网络连接会出现秒级别闪断(闪断时间随着 EIP 数量增加而变长,目前最多支持绑定 5 个 EIP 的 NAT 网关进行配置变更),请您尽量在业务低峰期执行切换操作。

  • EIP 绑定模式变更为 NAT 后,公网 NAT 网关将兼容 IPv4 网关,但绑定一个公网 EIP 时将占用 NAT 网关所在交换机的一个私网 IP,请确保 NAT 网关所在交换机内私网 IP 地址充足,如果 NAT 网关所在的交换机没有可用的空闲私网地址时,将无法绑定新的 EIP。

NAT

EnableSessionLog

boolean

否

是否开启会话日志,取值:

  • true:已开启会话日志。

  • false:已关闭会话日志。

true

LogDelivery

object

否

会话日志配置信息。

LogDeliveryType

string

否

会话日志写入类型。取值:sls,阿里云日志服务 SLS。

sls

LogDestination

string

否

会话日志写入地址。取值:acs:log:${regionName}:${projectOwnerAliUid}:project/${projectName}/logstore/${logstoreName}

acs:log:cn-hangzhou:0000:project/nat_session_log_project/logstore/session_log_test

返回参数

名称

类型

描述

示例值

object

请求 ID。

RequestId

string

请求 ID。

AB5F62CF-2B60-4458-A756-42C9DFE108D1

示例

正常返回示例

JSON格式

{
  "RequestId": "AB5F62CF-2B60-4458-A756-42C9DFE108D1"
}

错误码

HTTP status code

错误码

错误信息

描述

400 UnsupportedFeature.PrivateLinkMode The feature of %s is not supported. 暂不支持反向访问特性。
400 IncorrectStatus.NATGW NATGW status is invalid. NAT网关的状态不正确。
400 ExclusiveParam.%sAnd%s The param of %s and %s are mutually exclusive. 参数 %s 和 %s 相互排斥。
400 IncorrectStatus.NatGateway The status of natgateway is incorrect. NAT网关的状态不正确。
400 DependencyViolation.PrivateLinkMode The specified resource of %s depends on %s, so the operation cannot be completed. %s 资源依赖于 %s,因此本操作不能完成。
400 UnsupportedFeature.IcmpReplyEnabled The feature of IcmpReplyEnabled is not supported. Icmp 代答使能功能修改不支持。
400 InvalidParams.NotNull The parameter must not be null, name or description or icmpReplyEnabled 名称、描述以及icmp代答使能参数不能同时为空。
400 InvalidParameter.Name.Malformed The specified Name is not valid.
400 InvalidParameter.Description.Malformed The specified Description is not valid.
400 UnsupportedFeature.IndirectConvertForVpcNat The VPC NAT gateway is not support to change EIP bond type. VPC NAT网关不支持修改EIP的绑定类型。
400 UnsupportedFeature.NormalNatModifyEipBindMode The normal NAT gateway is not support to change EIP bond type. 普通型NAT网关不支持修改EIP绑定类型。
400 OperationDenied.EipBondTypeIsAlreadyNAT The EIP bond type is already NAT type. EIP绑定类型已经是NAT类型。
400 UnsupportedFeature.IndirectConvertForFwNat The security protection enabled NAT gateway is not support change EIP bond type. 开启防护功能的公网NAT不支持修改EIP绑定类型。
400 QuotaExceeded.EipNumForModifyEipBondType The quota of %s is exceeded, binded: %s, quota: %s. 修改EIP绑定类型时允许的EIP个数超限
400 ResourceNotEnough.SwitchAvailableIps The available private Ip number is not enough in your subnet. 子网中可用的私网IP不足。
400 UnsupportedFeature.VpcNatSecurityProtectionEnabled The VPC NAT gateway is not supported to enable security protection. VPC NAT网关不支持开启安全防护。
400 OperationDenied.NatGatewayStatusInvalid The NAT gateway status is invalid. NAT网关的状态无效。
400 OperationDenied.EipStatusInvalid The NAT gateway has EIP in invalid status. NAT网关绑定的EIP状态无效。
400 OperationDenied.SnatEntryStatusInvalid The NAT gateway has SNAT entry in invalid status. NAT网关配置的SNAT条目状态无效。
400 OperationDenied.DnatEntryStatusInvalid The NAT gateway has DNAT entry in invalid status. NAT网关配置的DNAT状态无效。
400 UnsupportedFeature.MutilBindedTypeNatEnableFw The NAT with Mutil-Binded Eip bind type is not support enable firewall. 以Mutil-Binded方式绑定EIP的NAT不允许开启防火墙。
400 Forbidden.FinancialLocked The instance is locked due to outstanding payments. 该实例已欠费锁定,无法操作
400 OperationFailed.PrivateLinkMode The NAT gateway is not support to change PrivateLinkMode. 当前NAT网关不支持修改PrivateLinkMode。
400 IllegalParam.SessionLogDeliveryDestination The specified Delivery Destination is illegal. 会话日志投递目标参数(SessionLogDeliveryDestination)配置格式无效
400 OperationFailed.LogDeliveryIsUnAuthorized Operation failed because the user is not authorized to deliver NAT session log. 操作失败因为您未授权NAT会话日志投递权限
400 IllegalParam.SessionLogDeliveryType The specified Delivery Type is illegal. 会话日志投递目标类型参数SessionLogDeliveryType输入不符合要求
400 UnsupportedFeature.EnableSessionLog The feature of EnableSessionLog is not supported. 当前实例不支持打开NAT网关会话日志。
500 OperationFailed.ConfigSessionLog Failed to configure session log due to a temporary failure of the server. 由于内部服务错误引起配置会话日志失败.
403 Forbidden.ModifyEipBondType Authentication is failed for modify EIP bond type. 不允许修改EIP绑定类型。
404 InvalidRegionId.NotFound The specified RegionId does not exist in our records.
404 InvalidNatGatewayId.NotFound The specified NatGatewayId does not exist in our records.

访问错误中心查看更多错误码。

变更历史

更多信息,参考变更详情。