All Products
Search
Document Center

NAT Gateway:ModifySnatEntry

Last Updated:Jun 19, 2026

Modifies a specified SNAT entry.

Operation description

ModifySnatEntry is an asynchronous operation. After you send a request, the system returns a request ID, but the SNAT entry has not been modified yet. The modification task is still running in the background. You can call DescribeSnatTableEntries to query the status of the SNAT entry:

  • If the SNAT entry is in the Pending state, the SNAT entry is being modified. In this state, you can only perform query operations and cannot perform other operations.

  • If the SNAT entry is in the Available state, the SNAT entry has been modified.

Note

If any SNAT entry in an SNAT table is in the Pending state, you cannot modify SNAT entries in the SNAT table.

The ModifySnatEntry operation does not support concurrent modifications of a specified SNAT entry within the same SNAT entry instance.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

vpc:ModifySnatEntry

update

*SnatTable

acs:vpc:{#regionId}:{#accountId}:snattable/{#SnatTableId}

None None

Request parameters

Parameter

Type

Required

Description

Example

RegionId

string

Yes

The region ID of the NAT gateway.

You can call the DescribeRegions operation to query the region ID.

cn-hangzhou

SnatTableId

string

Yes

The ID of the SNAT table to which the SNAT entry belongs.

stb-8vbczigrhop8x5u3t****

SnatEntryId

string

Yes

The ID of the SNAT entry that you want to modify.

snat-bp1vcgcf8tm0plqcg****

SnatIp

string

No

  • When you modify an SNAT entry for an Internet NAT gateway, this parameter specifies the EIPs in the SNAT entry. Separate multiple EIPs with commas (,).

Note

When you specify multiple EIPs to allocate an SNAT IP IPAM pool, service traffic is distributed across the EIPs by using a hash algorithm. Because traffic varies across connections, service traffic may be unevenly distributed across the EIPs. Add all EIPs to the same Internet Shared Bandwidth instance to prevent service interruptions caused by bandwidth throttling on a single EIP.

  • When you modify an SNAT entry for a VPC NAT gateway, this parameter specifies the NAT IP addresses in the SNAT entry. Separate multiple NAT IP addresses with commas (,).

  • The SnatIp and NetworkInterfaceId parameters cannot be specified at the same time.

47.98.XX.XX

SnatEntryName

string

No

The name of the SNAT entry.

The name must be 2 to 128 characters in length and must start with a letter or a Chinese character. It cannot start with http:// or https://.

SnatEntry-1

ClientToken

string

No

The client token that is used to ensure the idempotence of the request.

You can use the client to generate the token, but you must make sure that the token is unique among different requests. The ClientToken value can contain only ASCII characters.

Note

If you do not specify this parameter, the system uses the RequestId of the API request as the ClientToken. The RequestId may differ for each API request.

02fb3da4-130e-11e9-8e44-001****

EipAffinity

integer

No

Specifies whether to enable EIP affinity. Valid values:

  • 0: disables EIP affinity.

  • 1: enables EIP affinity.

Note

After you enable EIP affinity, if the SNAT entry is associated with multiple EIPs or NAT IP addresses, the same client uses the same EIP or NAT IP address for access. Otherwise, the client randomly selects an EIP or NAT IP address from the associated ones for access.

1

NetworkInterfaceId

string

No

The ID of the elastic network interfaces (ENIs).

Note

The IPv4 addresses of the network interface controller (NIC) are used as the SNAT addresses.

eni-gw8g131ef2dnbu3k****

DryRun

boolean

No

Specifies whether to perform a dry run. Valid values:

  • true: performs a dry run without modifying the SNAT entry. The system checks the required parameters, request format, and service limits. If the check fails, the corresponding error is returned. If the check succeeds, the DryRunOperation error code is returned.

  • false (default): performs a dry run and sends the request. After the check succeeds, a 2xx HTTP status code is returned and the SNAT entry is modified.

false

Response elements

Element

Type

Description

Example

object

The response body.

RequestId

string

The request ID.

2315DEB7-5E92-423A-91F7-4C1EC9AD****

Examples

Success response

JSON format

{
  "RequestId": "2315DEB7-5E92-423A-91F7-4C1EC9AD****"
}

Error codes

HTTP status code

Error code

Error message

Description

400 InvalidSnatIp.Malformed The specified SnatIp is not a valid IP address.
400 Forbidden.SourceVSwitchId.Duplicated The specified SourceCIDRis duplicated.
400 Forbidden.IpUsedInForwardTable The specified SnatIp already used in forward table
400 OperationUnsupported.EipForSnatPool The Eip cannot support snat pool
400 InvalidParameter.Name.Malformed The specified Name is not valid.
400 IncorretSnatEntryStatus The Specified SnatEntry is not stable status, can not operation
400 EIP_NOT_IN_GATEWAY The Eip not in nat gateway
400 InvalidParameter.SnatIp Error public ip must in same bandwidth package.
400 QuotaExceeded.SnatIp Public ip number exceeds quota.
400 InvalidSnatEntryId.NotFound Specified SNAT entry does not exist.
400 IncorrectStatus.SnatEntry The Specified SnatEntry is not stable status, can not operation The specified SNAT entries are not in a stable state and cannot be operated.
400 OperationFailed.CanNotUseEipInDnat Operation failed because the eip can not used by forward entry.
400 OperationUnsupported.EipNatGWCheck Operation unsupported because the relation check of eip and nat gateway is failed.
400 ResourceNotFound.SnatEntry Specified SNAT entry does not exist.
400 IncorrectStatus.NatIp Specified NatIp does not exist.
400 OperationFailed.CanNotUseNatIpInDnat Operation failed because the NatIp can not used by forward entry.
400 IncorrectStatus.NATGW NATGW status is invalid. The NAT gateway is in an invalid state.
400 OperationUnsupported.EipInBinding Create snat entry with eip in associating status is unsupported. You cannot use an associated EIP when you create an SNAT entry.
400 OperationUnsupported.EipNatBWPCheck The EIP is not associated with a NAT service plan. The EIP is not associated with a NAT service plan.
400 IllegalParam.NetworkInterfaceId The param of NetworkInterfaceId is illegal. Invalid NetworkInterfaceId value.
400 OperationFailed.SnatIpPoolBwpRules The operation failed because the IP in Snat entryl was added to multiple NAT bandwidth packets. The operation failed because the IP in the SNAT rule IP address pool was added to multiple NAT bandwidth packets.
400 OperationFailed.SnatIpPoolCbwpRules The operation failed because the SNAT rule IPs are added to multi bandwidth packages. The operation failed because the SNAT rule IP address pool was added to multiple bandwidth packages.
400 OperationFailed.SnatIpsTooMany The maximum number of IP addresses is exceeded in the SNAT pool. The maximum number of IP addresses is exceeded in the SNAT pool.
400 OperationFailed.SnatIpsCheck The operation fails because some IPs address in the SNAT entry are not added to common bandwidth packet. The operation fails because the IP address in the Snat rule IP address pool is not added to the shared bandwidth packet.
404 InvalidRegionId.NotFound The specified RegionId does not exist in our records.
404 InvalidSnatTableId.NotFound Specified SNAT table does not exist.
404 InvalidSnatEntryId.NotFound Specified SNAT entry does not exist.
404 InvalidSnatIp.NotFound Specified SnatIp does not found on the NAT Gateway
404 ResourceNotFound.NatIp Specified NatIp does not found on the NAT Gateway

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.