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

Usage notes

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

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 DescribeNatGateways

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

RegionId String Yes cn-hangzhou

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.

NatGatewayId String No ngw-bp1uewa15k4iy5770****

The ID of the NAT gateway.

VpcId String No vpc-bp15zckdt37pq72z****

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

Name String No test

The name of the NAT gateway.

The name must be 2 to 128 characters in length, and can contain letters, digits, underscores (_), and hyphens (-). The name must start with a letter.

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

InstanceChargeType String No PostPaid

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

Spec String No Example value for the Alibaba Cloud China site: Small. If you use the Alibaba Cloud International site, ignore this parameter.

The size of the NAT gateway. Ignore this parameter.

NatType String No Enhanced

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

ResourceGroupId String No rg-bp67acfmxazb4ph****

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

PageNumber Integer No 10

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

PageSize Integer No 1

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

DryRun Boolean No false

Specifies whether to precheck the request without performing the operation. Valid values:

  • true: prechecks the request without performing the operation. The system prechecks whether your AccessKey pair is valid, whether the Resource Access Management (RAM) user is authorized, and whether the required parameters are set. If the request fails to pass the precheck, the corresponding error message is returned. If the request passes the precheck, the DryRunOperation error code is returned.
  • false: sends the request. After the request passes the precheck, a 2xx HTTP status code is returned and the operation is performed. This is the default value.
Status String No Available

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.
NetworkType String No internet

The type of the NAT gateway. Valid values:

  • internet: an Internet NAT gateway
  • intranet: a VPC NAT gateway
Tag.N.Key String No KeyTest

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://.

Tag.N.Value String No valueTest

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://.

ZoneId String No cn-hangzhou-b

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

Response parameters

Parameter Type Example Description
PageSize Integer 10

The number of entries returned per page.

RequestId String 4EC47282-1B74-4534-BD0E-403F3EE64CAF

The ID of the request.

PageNumber Integer 10

The page number of the returned page.

TotalCount Integer 1

The number of NAT gateway entries that are returned.

NatGateways Array of NatGateway

The details about the NAT gateway.

NatGateway
Status String Creating

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.
CreationTime String 2021-06-08T12:20:20Z

The time when the NAT gateway was created.

VpcId String vpc-bp15zckdt37pq72z****

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

NatType String Enhanced

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

AutoPay Boolean false

Indicates whether automatic payment is enabled. Valid values:

  • false: no
  • true: yes
Spec String Small

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.

DeletionProtection Boolean true

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

  • true: yes
  • false: no
NetworkType String internet

The type of NAT gateway. Valid values:

  • internet: an Internet NAT gateway
  • intranet: a VPC NAT gateway
SecurityProtectionEnabled Boolean false

Indicates whether the firewall feature is enabled. Valid values:

  • false: no
  • true: yes
InstanceChargeType String PostPaid

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

RegionId String cn-hangzhou

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

EcsMetricEnabled Boolean true

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

  • true: yes
  • false: no
IcmpReplyEnabled Boolean false

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

  • true: yes
  • false: no
Description String NAT

The description of the NAT gateway.

ExpiredTime String 2021-08-26T16:00Z

The time when the NAT gateway expires.

ResourceGroupId String rg-bp67acfmxazb4ph****

The ID of the resource group.

NatGatewayId String ngw-bp1047e2d4z7kf2ki****

The ID of the NAT gateway.

InternetChargeType String PayByLcu

The metering method of the NAT gateway. Valid values:

  • PayBySpec: pay-by-specification
  • PayByLcu: pay-by-CU
BusinessStatus String Normal

The status of the NAT gateway. Valid values:

  • Normal: normal
  • FinancialLocked: locked due to overdue payments
Name String abc

The name of the NAT gateway.

IpLists Array of IpList

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

IpList
UsingStatus String UsedByForwardTable

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.
IpAddress String 116.62.XX.XX

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

SnatEntryEnabled Boolean false

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

  • true: yes
  • false: no
AllocationId String eip-m5egzuvp3dgixen6****

The ID of the EIP associated with the NAT gateway.

PrivateIpAddress String 192.168.XX.XX

The private IP address of the NAT gateway.

ForwardTableIds Array of String ftb-uf6gj3mhsg94qsqst****

The ID of the DNAT table.

SnatTableIds Array of String stb-uf6dalcdu0krz423p****

The ID of the SNAT table of the NAT gateway.

FullNatTableIds Array of String fulltb-gw88z7hhlv43rmb26****

The ID of the FULLNAT table.

NatGatewayPrivateInfo Object

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.
VswitchId String vsw-bp1s2laxhdf9ayjbo****

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

EniInstanceId String eni-m5eg4ozy5st8q3q4****

The ID of the elastic network interface (ENI).

MaxBandwidth Integer 5120

The maximum bandwidth. Unit: Mbit/s.

MaxSessionQuota Integer 2000000

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

MaxSessionEstablishRate Integer 100000

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

PrivateIpAddress String 192.168.XX.XX

The private IP address.

IzNo String cn-hangzhou-b

The zone to which the NAT gateway belongs.

EniType String indirect

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.
PrivateLinkEnabled Boolean true

Indicates whether the NAT gateway supports PrivateLink. Valid values:

  • true: yes
  • false: no
PrivateLinkMode String FullNat

The mode that is used by PrivateLink. Valid values:

  • FullNat: the FULLNAT mode
  • Geneve: the GENEVE mode
EipBindMode String MULTI_BINDED

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.
Tags Array of Tag

The tags that are added to the resource group.

Tag
TagKey String KeyTest

The tag key of the instance.

TagValue String valueTest

The tag value of the instance.

Examples

Sample requests

http(s)://[Endpoint]/?Action=DescribeNatGateways
&RegionId=cn-hangzhou
&NatGatewayId=ngw-bp1uewa15k4iy5770****
&VpcId=vpc-bp15zckdt37pq72z****
&Name=test
&InstanceChargeType=PostPaid
Example value for the Spec parameter: Small. You can use this value on the China site (aliyun.com). If you use the international site (alibabacloud.com), ignore this parameter.
&NatType=Enhanced
&ResourceGroupId=rg-bp67acfmxazb4ph****
&PageNumber=10
&PageSize=1
&DryRun=false
&Status=Available
&NetworkType=internet
&Tag=[{}]
&ZoneId=cn-hangzhou-b
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

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

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "PageSize" : 10,
  "RequestId" : "4EC47282-1B74-4534-BD0E-403F3EE64CAF",
  "PageNumber" : 10,
  "TotalCount" : 1,
  "NatGateways" : [ {
    "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" : [ {
      "UsingStatus" : "UsedByForwardTable",
      "IpAddress" : "116.62.XX.XX",
      "SnatEntryEnabled" : false,
      "AllocationId" : "eip-m5egzuvp3dgixen6****",
      "PrivateIpAddress" : "192.168.XX.XX"
    } ],
    "ForwardTableIds" : [ "ftb-uf6gj3mhsg94qsqst****" ],
    "SnatTableIds" : [ "stb-uf6dalcdu0krz423p****" ],
    "FullNatTableIds" : [ "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" : [ {
      "TagKey" : "KeyTest",
      "TagValue" : "valueTest"
    } ]
  } ]
}

Error codes

HTTP status code 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 does not exist.

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