Getting Information About Your NAT Services
You can get information about one or more of your NAT services, like its public IP or the Net and Subnet where it is located.
Getting Information About Your NAT Services Using OSC CLI
The ReadNatServices command lists one or more network address translation (NAT) services.
$ osc-cli api ReadNatServices --profile "default" \
--Filters '{
"NatServiceIds": ["nat-12345678"],
}'
$ osc-cli api ReadNatServices --profile "default" \
--Filters '{
"NetIds": ["vpc-12345678", "vpc-87654321"],
"SubnetIds": ["subnet-12345678"],
}'
This command contains the following attributes that you need to specify:
-
DryRun
: (optional) If true, checks whether you have the required permissions to perform the action. -
Filters
: (optional) One or more filters. -
NextPageToken
: (optional) The token to request the next page of results. Each token refers to a specific page. -
ResultsPerPage
: (optional) The maximum number of logs returned in a single response (between1`and `1000
, both included). By default,100
.
The ReadNatServices command returns the following elements:
-
NatServices
: Information about one or more NAT services. -
NextPageToken
: The token to request the next page of results. Each token refers to a specific page. -
ResponseContext
: Information about the context of the response.
{
"ResponseContext": {
"RequestId": "0475ca1e-d0c5-441d-712a-da55a4175157"
},
"NatServices": [
{
"Tags": [],
"SubnetId": "subnet-12345678",
"NatServiceId": "nat-12345678",
"PublicIps": [
{
"PublicIpId": "eipalloc-12345678",
"PublicIp": "192.0.2.0"
}
],
"NetId": "vpc-12345678",
"State": "available"
}
]
}
Getting Information About Your NAT Gateways Using AWS CLI
To get information about one or more NAT gateways, use the describe-nat-gateways command following this syntax:
$ aws ec2 describe-nat-gateways \
--profile YOUR_PROFILE \
--nat-gateway-ids [NOT_SPECIFIED] \
--filters "Name=state,Values=available" \
--endpoint https://fcu.eu-west-2.outscale.com
This command contains the following attributes that you need to specify:
-
(optional)
profile
: The named profile you want to use, created when configuring AWS CLI. For more information, see Installing and Configuring AWS CLI. -
(optional)
nat-gateway-ids
: One or more IDs of NAT gateways.
(optional) filters
: One or more filters, in the "Name=X,Values=Y" format.
You can specify several values for a same filter using the "Name=X,Values=Y, Z" format. |
The following filters are available:
-
nat-gateway-id
: The ID of the NAT gateway. -
state
: The state of the NAT gateway (pending
|available
|deleting
|deleted
). For more information, see About NAT Services. -
subnet-id
: The ID of the subnet in which the NAT gateway is.-
vpc-id
: The ID of the VPC in which the NAT gateway is.-
tag-key
: The key of a tag associated with the resource. -
tag-value
: The value of a tag associated with the resource. -
tag:XXXX
: The value of a tag associated with the resource, whereXXXX
is the key of the tag.To filter a tag whose key is
XXXX
and value isYYYY
, you can therefore use either of the following two formats:-
--filters Name=tag-key,Values=XXXX Name=tag-value,Values=YYYY
-
--filters Name=tag:XXXX,Values=YYYY
-
-
endpoint
: The endpoint corresponding to the Region you want to send the request to.
-
-
The describe-nat-gateways command returns the following elements:
-
NatGateways
: Information about one or more NAT gateways. This element contains the following information: -
CreateTime
: The date and time of creation of the NAT gateway.-
NatGatewayAddresses
: Information about the EIP associated with the NAT gateway. This element contains the following information:-
AllocationId
: The allocation ID of the EIP. -
PublicIp
: The EIP associated with the NAT gateway.
-
-
-
NatGatewayId
: The ID of the NAT gateway. -
State
: The state of the NAT gateway. For more information, see About NAT Services. -
SubnetId
: The ID of the subnet in which the NAT gateway is. -
VpcId
: The ID of the VPC in which the NAT gateway is. -
Tags
: The tags associated with the resources.-
Key
: The key of the tags. -
Value
: The value of the tags.
-
{
"NatGateways": [
{
"CreateTime": "2016-11-08T10:58:42.654Z",
"NatGatewayAddresses": [
{
"AllocationId": "eipalloc-87654321",
"PublicIp": "111.1.1.1"
}
],
"NatGatewayId": "nat-5678efgh",
"State": "available",
"SubnetId": "subnet-4321dcba",
"VpcId": "vpc-1234abcd",
"Tags": []
}
]
}
Related Pages
Corresponding API Methods
AWS™ and Amazon Web Services™ are trademarks of Amazon Technologies, Inc or its affiliates in the United States and/or other countries.