Queries NAT gateways.

Description

You can call this operation to query an Internet NAT gateway or a virtual private cloud (VPC) NAT gateway. The term "NAT gateway" in this topic refers to both NAT gateway types.

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 a 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 ID of the region where the NAT gateways are deployed. You can call the DescribeRegions operation to query the most recent region list.

NatGatewayId String No ngw-bp1uewa15k4iy5770****

The ID of the NAT gateway that you want to query.

VpcId String No vpc-bp15zckdt37pq72z****

The ID of the virtual private cloud (VPC) where the NAT gateway is deployed.

Name String No test

The name of the NAT gateway.

InstanceChargeType String No PostPaid

The billing method of the NAT gateway. Valid values:

  • PostPaid: pay-as-you-go
  • PrePaid: subscription
Note If the NAT gateways are created on Alibaba Cloud International Site, set the value to PostPaid.
Spec String No Large

The size of the Internet NAT gateway. Valid values:

  • Small (default): small
  • Middle: medium
  • Large: large
NatType String No Normal

The type of the Internet NAT gateway. Valid values:

  • Normal: standard
  • Enhanced: enhanced
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 true

Specifies whether to precheck this request. Valid values:

  • true: prechecks the request only. Resources are not queried. The system checks whether your AccessKey pair is valid, whether the Resource Access Management (RAM) user is authorized, and whether required parameters are set. If the request fails the precheck, the corresponding error message is returned. If the request passes the precheck, the DryRunOperation error code is returned.
  • false: prechecks the request. This is the default value. After the request passes the precheck, a 2xx HTTP status code is returned and resources are queried.
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: If the operation is successful, the NAT gateway is created and the NAT gateway changes to the Available state.
  • 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

Response parameters

Parameter Type Example Description
NatGateways Array of NatGateway

Detailed information about the NAT gateways.

NatGateway
BusinessStatus String Normal

The state of the NAT gateway. Valid values:

  • Normal: normal
  • FinancialLocked: locked due to overdue payments
CreationTime String 2020-06-08T12:20:20Z

The time when the NAT gateway was created. The time follows the ISO 8601 standard in UTC in the YYYY-MM-DDThh:mm:ssZ format.

DeletionProtection Boolean true

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

  • true: enabled
  • false: disabled
Description String NAT

The description of the NAT gateway.

EcsMetricEnabled Boolean true

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

  • true: enabled
  • false: disabled
ExpiredTime String 2020-08-26T16:00Z

The time when the NAT gateway expires.

ForwardTableIds List ftb-uf6gj3mhsg94qsqst****

The ID of the DNAT table.

IcmpReplyEnabled Boolean false

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

  • true: enabled
  • false: disabled
InstanceChargeType String PostPaid

The billing method of the NAT gateway. Valid values:

  • PostPaid: pay-as-you-go
  • PrePaid: subscription
Note If the NAT gateways are created on Alibaba Cloud International Site, the value is set to PostPaid.
InternetChargeType String PayBySpec

The metering method for the NAT gateway. Valid values:

  • PayBySpec: pay-by-specification
  • PayByLcu: pay-by-actual-usage
IpLists Array of IpList

The IP address information about the NAT gateway.

IpList
IpAddress String 116.62.XX.XX

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

PrivateIpAddress String 192.168.XX.XX

The private IP address of 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
Name String abc

The name of the NAT gateway.

NatGatewayId String ngw-bp1047e2d4z7kf2ki****

The ID of the NAT gateway.

NatGatewayPrivateInfo Struct

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.
EniInstanceId String 10

The ID of the elastic network interface (ENI).

EniType String Secondary

The type of the ENI. Valid values:

  • Primary: primary
  • Secondary: secondary
IzNo String cn-hangzhou-b

The zone to which the NAT gateway belongs.

MaxBandwidth Integer 5120

The maximum bandwidth. Unit: Mbit/s.

PrivateIpAddress String 192.168.XX.XX

The private IP address.

VswitchId String vsw-bp1s2laxhdf9ayjbo****

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

NatType String Normal

The type of the Internet NAT gateway. Valid values:

  • Normal: normal
  • Enhanced: enhanced
NetworkType String internet

The type of the NAT gateway. Valid values:

  • internet: an Internet NAT gateway
  • intranet: a VPC NAT gateway
RegionId String cn-hangzhou

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

ResourceGroupId String rg-bp67acfmxazb4ph****

The ID of the resource group.

SecurityProtectionEnabled Boolean false

Indicates whether the firewall feature is enabled. Valid values:

  • false: no
  • true: yes
SnatTableIds List stb-uf6dalcdu0krz423p****

The ID of the SNAT table that is associated with the NAT gateway.

Spec String Small

The type of the NAT gateway. Valid values:

  • Small: small
  • Middle: medium
  • Large: large
Status String Creating

The state 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: If the operation is successful, the NAT gateway is created and the NAT gateway changes to the Available state.
  • 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.
VpcId String vpc-bp15zckdt37pq72z****

The ID of the virtual private cloud (VPC) to which the NAT gateway belongs.

PageNumber Integer 10

The page number of the returned page.

PageSize Integer 10

The number of entries returned per page.

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

The ID of the request.

TotalCount Integer 10

The total number of entries returned.

Examples

Sample requests

http(s)://[Endpoint]/?Action=DescribeNatGateways
&RegionId=cn-hangzhou
&<Common request parameters>

Sample success responses

XML format

<DescribeNatGatewaysResponse>
  <TotalCount>10</TotalCount>
  <RequestId>4EC47282-1B74-4534-BD0E-403F3EE64CAF    </RequestId>
  <PageSize>10</PageSize>
  <PageNumber>10</PageNumber>
  <NatGateways>
        <NatGateway>
              <Status>Creating</Status>
              <Description>NAT</Description>
              <ResourceGroupId>rg-bp67acfmxazb4ph****</ResourceGroupId>
              <InstanceChargeType>PostPaid</InstanceChargeType>
              <SecurityProtectionEnabled>false</SecurityProtectionEnabled>
              <DeletionProtection>true</DeletionProtection>
              <BusinessStatus>Normal</BusinessStatus>
              <NatType>Normal</NatType>
              <Name>abc</Name>
              <InternetChargeType>PayBySpec</InternetChargeType>
              <EcsMetricEnabled>true</EcsMetricEnabled>
              <VpcId>vpc-bp15zckdt37pq72z****</VpcId>
              <NetworkType>internet</NetworkType>
              <ExpiredTime>2020-08-26T16:00Z</ExpiredTime>
              <IcmpReplyEnabled>false</IcmpReplyEnabled>
              <CreationTime>2020-06-08T12:20:20Z</CreationTime>
              <RegionId>cn-hangzhou</RegionId>
              <Spec>Small</Spec>
              <NatGatewayId>ngw-bp1047e2d4z7kf2ki****</NatGatewayId>
              <IpLists>
                    <IpList>
                          <PrivateIpAddress>192.168.XX.XX</PrivateIpAddress>
                          <SnatEntryEnabled>false</SnatEntryEnabled>
                          <IpAddress>116.62.XX.XX</IpAddress>
                    </IpList>
              </IpLists>
              <ForwardTableIds>
                    <ForwardTableId>ftb-uf6gj3mhsg94qsqst****</ForwardTableId>
              </ForwardTableIds>
              <SnatTableIds>
                    <SnatTableId>stb-uf6dalcdu0krz423p****</SnatTableId>
              </SnatTableIds>
              <NatGatewayPrivateInfo>
                    <IzNo>cn-hangzhou-b</IzNo>
                    <PrivateIpAddress>192.168.XX.XX</PrivateIpAddress>
                    <MaxBandwidth>5120</MaxBandwidth>
                    <EniType>Secondary</EniType>
                    <EniInstanceId>10</EniInstanceId>
                    <VswitchId>vsw-bp1s2laxhdf9ayjbo****</VswitchId>
              </NatGatewayPrivateInfo>
        </NatGateway>
  </NatGateways>
</DescribeNatGatewaysResponse>

JSON format

{
    "TotalCount": 10,
    "RequestId": "4EC47282-1B74-4534-BD0E-403F3EE64CAF",
    "PageSize": 10,
    "PageNumber": 10,
    "NatGateways": {
        "NatGateway": {
            "Status": "Creating",
            "Description": "NAT",
            "ResourceGroupId": "rg-bp67acfmxazb4ph****",
            "InstanceChargeType": "PostPaid",
            "SecurityProtectionEnabled": false,
            "DeletionProtection": true,
            "BusinessStatus": "Normal",
            "NatType": "Normal",
            "Name": "abc",
            "InternetChargeType": "PayBySpec",
            "EcsMetricEnabled": true,
            "VpcId": "vpc-bp15zckdt37pq72z****",
            "NetworkType": "internet",
            "ExpiredTime": "2020-08-26T16:00Z",
            "IcmpReplyEnabled": false,
            "CreationTime": "2020-06-08T12:20:20Z",
            "RegionId": "cn-hangzhou",
            "Spec": "Small",
            "NatGatewayId": "ngw-bp1047e2d4z7kf2ki****",
            "IpLists": {
                "IpList": {
                    "PrivateIpAddress": "192.168.XX.XX",
                    "SnatEntryEnabled": false,
                    "IpAddress": "116.62.XX.XX"
                }
            },
            "ForwardTableIds": {
                "ForwardTableId": "ftb-uf6gj3mhsg94qsqst****"
            },
            "SnatTableIds": {
                "SnatTableId": "stb-uf6dalcdu0krz423p****"
            },
            "NatGatewayPrivateInfo": {
                "IzNo": "cn-hangzhou-b",
                "PrivateIpAddress": "192.168.XX.XX",
                "MaxBandwidth": 5120,
                "EniType": "Secondary",
                "EniInstanceId": 10,
                "VswitchId": "vsw-bp1s2laxhdf9ayjbo****"
            }
        }
    }
}

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

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