All Products
Search
Document Center

NAT Gateway:DescribeNatGateways

Last Updated:Nov 14, 2024

Queries NAT gateways that meet specific conditions in a specified region.

Operation description

You can call this operation to query both Virtual Private Cloud (VPC) NAT gateways and Internet NAT gateways. NAT gateways in this topic refer to both VPC NAT gateways and Internet NAT gateways.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
vpc:DescribeNatGatewaysget
  • NatGateway
    acs:vpc:{#regionId}:{#accountId}:natgateway/*
  • NatGateway
    acs:vpc:{#regionId}:{#accountId}:natgateway/{#NatGatewayId}
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
RegionIdstringYes

The region ID of the NAT gateways that you want to query.

You can call the DescribeRegions operation to query the most recent region list.

cn-hangzhou
NatGatewayIdstringNo

The ID of the NAT gateway.

ngw-bp1uewa15k4iy5770****
VpcIdstringNo

The ID of the VPC to which the NAT gateway belongs.

vpc-bp15zckdt37pq72z****
NamestringNo

The name of the NAT gateway.

The name must be 1 to 128 characters in length, and cannot start with http:// or https://.

If this parameter is not set, the system automatically assigns a name to the NAT gateway.

test
InstanceChargeTypestringNo

The billing method of the NAT gateway. Set the value to PostPaid, which specifies the pay-as-you-go billing method.

PostPaid
SpecstringNo

The size of the NAT gateway. Ignore this parameter.

Invalid parameter.
NatTypestringNo

The type of NAT gateway. Set the value to Enhanced (enhanced NAT gateway).

Enhanced
ResourceGroupIdstringNo

The ID of the resource group to which the NAT gateway belongs.

rg-bp67acfmxazb4ph****
PageNumberintegerNo

The number of the page to return. Default value: 1.

10
PageSizeintegerNo

The number of entries to return on each page. Maximum value: 50. Default value: 10.

1
DryRunbooleanNo

Specifies whether to perform a dry run. Valid values:

  • true: performs a dry run. The system prechecks whether your AccessKey pair is valid, whether the RAM user is authorized, and whether the required parameters are specified. If the request fails the dry run, an error message is returned. If the request passes the dry run, the DryRunOperation error code is returned.
  • false (default): performs a dry run and sends the request. If the request passes the dry run, a 2xx HTTP status code is returned and the operation is performed.
false
StatusstringNo

The status of the NAT gateway. Valid values:

  • Creating: After you send a request to create a NAT gateway, the system creates the NAT gateway in the background. The NAT gateway remains in the Creating state until the operation is completed.
  • Available: The NAT gateway remains in a stable state after the NAT gateway is created.
  • Modifying: After you send a request to modify a NAT gateway, the system modifies the NAT gateway in the background. The NAT gateway remains in the Modifying state until the operation is completed.
  • Deleting: After you send a request to delete a NAT gateway, the system deletes the NAT gateway in the background. The NAT gateway remains in the Deleting state until the operation is completed.
  • Converting: After you send a request to upgrade a standard NAT gateway to an enhanced NAT gateway, the system upgrades the NAT gateway in the background. The NAT gateway remains in the Converting state until the operation is completed.
Available
NetworkTypestringNo

The type of the NAT gateway. Valid values:

  • internet: an Internet NAT gateway
  • intranet: a VPC NAT gateway
internet
Tagarray<object>No

The tags.

objectNo

The tags.

KeystringNo

The tag keys of the NAT gateway. You can specify up to 20 tag keys.

Each tag key cannot exceed 64 characters in length, and cannot start with aliyun or acs:. It cannot contain http:// or https://.

KeyTest
ValuestringNo

The tag values of the NAT gateway. You can specify up to 20 tag values.

The tag value cannot exceed 128 characters in length, and cannot start with aliyun or acs:. The value cannot contain http:// or https://.

valueTest
ZoneIdstringNo

The ID of the zone to which the NAT gateway belongs.

cn-hangzhou-b

Response parameters

ParameterTypeDescriptionExample
object
PageSizeinteger

The number of entries returned per page.

10
RequestIdstring

The ID of the request.

4EC47282-1B74-4534-BD0E-403F3EE64CAF
PageNumberinteger

The page number of the returned page.

10
TotalCountinteger

The number of NAT gateway entries that are returned.

1
NatGatewaysarray<object>

The details about the NAT gateway.

NatGatewayobject
Statusstring

The status of the NAT gateway. Valid values:

  • Creating: After you send a request to create a NAT gateway, the system creates the NAT gateway in the background. The NAT gateway remains in the Creating state until the operation is completed.
  • Available: The NAT gateway remains in a stable state after the NAT gateway is created.
  • Modifying: After you send a request to modify a NAT gateway, the system modifies the NAT gateway in the background. The NAT gateway remains in the Modifying state until the operation is completed.
  • Deleting: After you send a request to delete a NAT gateway, the system deletes the NAT gateway in the background. The NAT gateway remains in the Deleting state until the operation is completed.
  • Converting: After you send a request to upgrade a standard NAT gateway to an enhanced NAT gateway, the system upgrades the NAT gateway in the background. The NAT gateway remains in the Converting state until the operation is completed.
Creating
CreationTimestring

The time when the NAT gateway was created.

2021-06-08T12:20:20Z
VpcIdstring

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

vpc-bp15zckdt37pq72z****
NatTypestring

The type of the NAT gateway. The value is set to Enhanced (enhanced NAT gateway).

Enhanced
AutoPayboolean

Indicates whether automatic payment is enabled. Valid values:

  • false: no
  • true: yes
false
Specstring

The size of the NAT gateway. An empty value is returned for the parameter.

If InternetChargeType is set to PayByLcu, an empty value is returned.

Small
DeletionProtectionboolean

Indicates whether the deletion protection feature is enabled. Valid values:

  • true: yes
  • false: no
true
NetworkTypestring

The type of NAT gateway. Valid values:

  • internet: an Internet NAT gateway
  • intranet: a VPC NAT gateway
internet
SecurityProtectionEnabledboolean

Indicates whether the firewall feature is enabled. Valid values:

  • false: no
  • true: yes
false
InstanceChargeTypestring

The billing method of the NAT gateway. The value is set to PostPaid, which indicates the pay-as-you-go billing method.

PostPaid
RegionIdstring

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

cn-hangzhou
EcsMetricEnabledboolean

Indicates whether the traffic monitoring feature is enabled. Valid values:

  • true: yes
  • false: no
true
IcmpReplyEnabledboolean

Indicates whether the ICMP non-retrieval feature is enabled. Valid values:

  • true: yes
  • false: no
false
Descriptionstring

The description of the NAT gateway.

NAT
ExpiredTimestring

The time when the NAT gateway expires.

2021-08-26T16:00Z
ResourceGroupIdstring

The ID of the resource group to which the contiguous EIP group belongs.

rg-bp67acfmxazb4ph****
NatGatewayIdstring

The ID of the NAT gateway.

ngw-bp1047e2d4z7kf2ki****
InternetChargeTypestring

The metering method of the NAT gateway. Valid values:

  • PayBySpec: pay-by-specification
  • PayByLcu: pay-by-CU
PayByLcu
BusinessStatusstring

The status of the NAT gateway. Valid values:

  • Normal: normal
  • FinancialLocked: locked due to overdue payments
Normal
Namestring

The name of the NAT gateway.

abc
IpListsarray<object>

The list of elastic IP addresses (EIPs) that are associated with the Internet NAT gateway.

IpListobject
UsingStatusstring

The association between the EIP and the Internet NAT gateway. Valid values:

  • UsedByForwardTable: The EIP is specified in a DNAT entry.
  • UsedBySnatTable: The EIP is specified in an SNAT entry.
  • UsedByForwardSnatTable: The EIP is specified in both an SNAT entry and a DNAT entry.
  • Idle: The EIP is not specified in a DNAT or SNAT entry.
UsedByForwardTable
IpAddressstring

The IP address of the EIP associated with the NAT gateway.

116.62.XX.XX
SnatEntryEnabledboolean

Indicates whether IP addresses that are used in DNAT entries can be specified in SNAT entries. Valid values:

  • true: yes
  • false: no
false
AllocationIdstring

The ID of the EIP associated with the NAT gateway.

eip-m5egzuvp3dgixen6****
PrivateIpAddressstring

The private IP address of the NAT gateway.

192.168.XX.XX
ForwardTableIdsarray

The ID of the DNAT table.

ForwardTableIdstring

The ID of the DNAT table.

ftb-uf6gj3mhsg94qsqst****
SnatTableIdsarray

The ID of the SNAT table of the NAT gateway.

SnatTableIdstring

The ID of the SNAT table of the NAT gateway.

stb-uf6dalcdu0krz423p****
FullNatTableIdsarray

The ID of the FULLNAT table.

FullNatTableIdstring

The ID of the FULLNAT table.

fulltb-gw88z7hhlv43rmb26****
NatGatewayPrivateInfoobject

The private network information about the enhanced Internet NAT gateway.

Note If NatType is set to Normal, all parameters returned in this list are empty.
VswitchIdstring

The ID of the vSwitch to which the NAT gateway belongs.

vsw-bp1s2laxhdf9ayjbo****
EniInstanceIdstring

The ID of the elastic network interface (ENI).

eni-m5eg4ozy5st8q3q4****
MaxBandwidthinteger

The maximum bandwidth. Unit: Mbit/s.

5120
MaxSessionQuotainteger

The number of concurrent connections to the NAT gateway. Unit: connections.

2000000
MaxSessionEstablishRateinteger

The number of new connections to the NAT gateway. Unit: connections per second.

100000
PrivateIpAddressstring

The private IP address.

192.168.XX.XX
IzNostring

The zone to which the NAT gateway belongs.

cn-hangzhou-b
EniTypestring

The mode in which the ENI is associated with the NAT gateway.

  • indirect: non-cut-through mode
  • If an empty value is returned, it indicates that the cut-through mode is used.
indirect
PrivateLinkEnabledboolean

Indicates whether the NAT gateway supports PrivateLink. Valid values:

  • true: yes
  • false: no
true
PrivateLinkModestring

The mode that is used by PrivateLink. Valid values:

  • FullNat: the FULLNAT mode
  • Geneve: the GENEVE mode
FullNat
EipBindModestring

The mode in which the NAT gateway is associated with an elastic IP address (EIP). Valid values:

  • MULTI_BINDED: multi-EIP-to-ENI mode
  • NAT: NAT mode, which is compatible with IPv4 addresses.
Note Note: If you use the NAT mode, the EIP occupies one private IP address on the vSwitch of the NAT gateway. Make sure that the vSwitch has sufficient private IP addresses. Otherwise, the NAT gateway fails to be associated with the EIP. In NAT mode, you can associate a NAT gateway with up to 50 EIPs.
MULTI_BINDED
Tagsarray<object>

The tags that are added to the resource group.

Tagobject
TagKeystring

The tag key of the instance.

KeyTest
TagValuestring

The tag value of the instance.

valueTest

Examples

Sample success responses

JSONformat

{
  "PageSize": 10,
  "RequestId": "4EC47282-1B74-4534-BD0E-403F3EE64CAF",
  "PageNumber": 10,
  "TotalCount": 1,
  "NatGateways": {
    "NatGateway": [
      {
        "Status": "Creating",
        "CreationTime": "2021-06-08T12:20:20Z",
        "VpcId": "vpc-bp15zckdt37pq72z****",
        "NatType": "Enhanced",
        "AutoPay": false,
        "Spec": "Small",
        "DeletionProtection": true,
        "NetworkType": "internet",
        "SecurityProtectionEnabled": false,
        "InstanceChargeType": "PostPaid",
        "RegionId": "cn-hangzhou",
        "EcsMetricEnabled": true,
        "IcmpReplyEnabled": false,
        "Description": "NAT",
        "ExpiredTime": "2021-08-26T16:00Z",
        "ResourceGroupId": "rg-bp67acfmxazb4ph****",
        "NatGatewayId": "ngw-bp1047e2d4z7kf2ki****",
        "InternetChargeType": "PayByLcu",
        "BusinessStatus": "Normal",
        "Name": "abc",
        "IpLists": {
          "IpList": [
            {
              "UsingStatus": "UsedByForwardTable",
              "IpAddress": "116.62.XX.XX",
              "SnatEntryEnabled": false,
              "AllocationId": "eip-m5egzuvp3dgixen6****",
              "PrivateIpAddress": "192.168.XX.XX"
            }
          ]
        },
        "ForwardTableIds": {
          "ForwardTableId": [
            "ftb-uf6gj3mhsg94qsqst****"
          ]
        },
        "SnatTableIds": {
          "SnatTableId": [
            "stb-uf6dalcdu0krz423p****"
          ]
        },
        "FullNatTableIds": {
          "FullNatTableId": [
            "fulltb-gw88z7hhlv43rmb26****"
          ]
        },
        "NatGatewayPrivateInfo": {
          "VswitchId": "vsw-bp1s2laxhdf9ayjbo****",
          "EniInstanceId": "eni-m5eg4ozy5st8q3q4****",
          "MaxBandwidth": 5120,
          "MaxSessionQuota": 2000000,
          "MaxSessionEstablishRate": 100000,
          "PrivateIpAddress": "192.168.XX.XX",
          "IzNo": "cn-hangzhou-b",
          "EniType": "indirect"
        },
        "PrivateLinkEnabled": true,
        "PrivateLinkMode": "FullNat",
        "EipBindMode": "MULTI_BINDED",
        "Tags": {
          "Tag": [
            {
              "TagKey": "KeyTest",
              "TagValue": "valueTest"
            }
          ]
        }
      }
    ]
  }
}

Error codes

HTTP status codeError codeError messageDescription
404InvalidRegionId.NotFoundThe specified RegionId does not exist in our records.The specified region ID does not exist.
500InternalErrorThe request processing has failed due to some unknown error, exception or failure.An internal error occurred.

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2024-10-23The Error code has changed. The response structure of the API has changedView Change Details
2024-05-07The Error code has changed. The response structure of the API has changedView Change Details
2024-01-18API Description Update. The Error code has changedView Change Details
2023-03-01The Error code has changedView Change Details
2022-08-26The Error code has changed. The request parameters of the API has changed. The response structure of the API has changedView Change Details
2021-11-17The Error code has changed. The response structure of the API has changedView Change Details
2021-11-17The Error code has changed. The response structure of the API has changedView Change Details