Changes the size of a NAT gateway.


ModifyNatGatewaySpec is an asynchronous operation. After you make a request, the ID of the request is returned but the specified NAT gateway is not modified. The system modifies the NAT gateway in the background. You can call the DescribeNatGateways operation to query the state of the NAT gateway:

  • Modifying: indicates that the system is modifying the NAT gateway. You can only query the state of the NAT gateway, but cannot perform other operations.
  • Available: indicates that the NAT gateway is modified.

NAT gateways are available in different sizes. The size of a NAT gateway determines the Source Network Address Translation (SNAT) performance of the gateway, such as the maximum number of connections and the number of new connections per second. However, the data throughput is not affected. The following table describes the correlations between different sizes of NAT gateways and SNAT performance metrics.


Maximum number of connections

Number of new connections per second










Super Large-1




OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes ModifyNatGatewaySpec

The operation that you want to perform. Set the value to ModifyNatGatewaySpec.

NatGatewayId String Yes ngw-bp1uewa15k4iy5770****

The ID of the NAT gateway.

RegionId String Yes cn-hangzhou

The ID of the region where the NAT gateway is deployed.

Spec String Yes Small

The size of the NAT gateway. Valid values:

  • Small: a small-sized NAT gateway.
  • Middle: a medium-sized NAT gateway.
  • Large: a large-sized NAT gateway.
  • XLarge.1: a super large-sized NAT gateway.
AutoPay Boolean No false

Specifies whether automatic payment is enabled for the instance.

  • true: enables automatic payment.
  • false: disables automatic payment. This is the default value.
ClientToken String No SHA234js121223****

The client token that is used to ensure the idempotence of the request. You can use the client to generate a value that is unique among different requests.ClientToken can contain only ASCII characters and cannot exceed 64 characters in length.

Response parameters

Parameter Type Example Description
RequestId String DBD4E4A2-786E-4BD2-8EB6-107FFC2B5B7D

The ID of the request.


Sample requests
&<Common request parameters>|

Sample success responses

XML format


JSON format

    "RequestId": "DBD4E4A2-786E-4BD2-8EB6-107FFC2B5B7D"

Error codes

HttpCode Error code Error message Description
404 InvalidRegionId.NotFound The specified RegionId does not exist in our records. The error message returned because the specified region ID is invalid. Check whether the service is available in the specified region.
404 InvalidNatGatewayId.NotFound The specified NatGatewayId does not exist in our records. The error message returned because the specified NAT gateway ID does not exist. Check whether the value of the NatGatewayId parameter is valid.
400 NATGW_MODIFY_SPEC_SAME The specified Spec is same with now. The error message returned because the specified gateway size is the same as the current gateway size.
400 InvalidParameter.Spec.ValueNotSupported The specified Spec is not valid. The error message returned because the specified gateway size is invalid.

For a list of error codes, visit the API Error Center.