Note: if you are running CloudGraph locally you can view the interactive, automatically generated documentation in either GraphQL Playground or Altair by clicking the docs button on the right-hand side of the screen. After reading the below information we highly suggest you use one of these tools to test your queries as they will autocomplete fields for you and let you know if your queries are valid before you even submit them.
You can currently query the following attributes and connections on an AWS NAT Gateway
query {
queryawsNatGateway {
id
accountId
arn
region
state
createTime
dailyCost {
cost
currency
formattedCost
}
tags {
id
key
value
}
networkInterface {
arn
}
subnet {
arn
}
vpc {
arn
}
}
}
Get data for a single AWS NAT Gateway that you know the ID or arn for:
query {
getawsNatGateway(id: "12345") {
arn
}
}
query {
getawsNatGateway(arn: "arn:aws:ec2:us-east-1:111122223333:natgateway/nat-11122223333f466ec") {
arn
}
}
Get data for all of the NAT Gateways in a certain AWS account:
query {
queryawsNatGateway(filter: { accountId: { eq: "12345" } }) {
arn
}
}
Get data for all of the NAT Gateways that are NOT in a certain AWS account:
query {
queryawsNatGateway(filter: { not: { accountId: { eq: "12345" } } }) {
arn
}
}
Get data for all of the NAT Gateways that have a connected subnet:
query {
queryawsNatGateway(filter: { has: subnet }) {
arn
}
}
Use multiple filter selectors, (i.e. has, and, not, or) to get data for all of the NAT Gateways that have subnet instances AND vpc instances connected to them OR that do not have networkInterface instances connected to them. Note that you can use has, and, not, or completely independently of each other:
query {
queryawsNatGateway(
filter: {
has: subnet
and: { has: vpc }
or: { not: { has: networkInterface } }
}
) {
arn
}
}
You may also filter using a regex when filtering on a string field like, region if you want to look for a value that matches say, us- to get all NAT Gateways in us regions:
query {
queryawsNatGateway(filter: { region: { regexp: "/.*us-*/" } }) {
arn
}
}
You can order the results you get back either asc or desc depending on your preference:
query {
queryawsNatGateway(order: { desc: createTime }) {
arn
}
}
Only select and return the first two NAT Gateways that are found:
query {
queryawsNatGateway(first: 2, order: { desc: createTime }) {
arn
}
}
Only select and return the first two NAT Gateways that are found, but offset by one so gateways two & three are returned:
query {
queryawsNatGateway(first: 2, order: { desc: createTime }, offset: 1) {
arn
}
}
Count the number NAT Gateways across all scanned AWS accounts:
query {
aggregateawsNatGateway {
count
}
}
Count the number of NAT Gateways in a single account. Note that you can apply all of the same filters that are listed above to aggregate queries:
query {
aggregateawsNatGateway(filter: { accountId: { eq: "12345" } }) {
count
}
}
Find all of the NAT Gateways that are in the us-east-1 region across all your accounts:
query {
queryawsNatGateway(filter: { region: { eq: "us-east-1" } }) {
arn
}
}
Putting it all together; get all data for all NAT Gateways across all regions for all scanned AWS accounts in a single query. For the purposes of this example we will only get direct children of the gateways but if you want to it's easy to go from say, gateway -> vpc -> routeTable ...etc:
query {
queryawsNatGateway {
id
accountId
arn
region
state
createTime
dailyCost {
cost
currency
formattedCost
}
networkInterface {
id
accountId
arn
region
subnetId
macAddress
description
availabilityZone
status
vpcId
interfaceType
securityGroups
privateDnsName
privateIps
attachment {
id
attachmentId
deleteOnTermination
status
}
tags {
id
key
value
}
ec2Instance {
arn
}
eip {
arn
}
natGateway {
arn
}
subnet {
arn
}
vpc {
arn
}
}
subnet {
id
accountId
arn
region
autoAssignPublicIpv4Address
autoAssignPublicIpv6Address
availabilityZone
availableIpV4Addresses
defaultForAz
ipV4Cidr
ipV6Cidr
state
tags {
id
key
value
}
alb {
arn
}
asg {
arn
}
ec2Instance {
arn
}
elb {
arn
}
lambda {
arn
}
natGateway {
arn
}
networkInterface {
arn
}
routeTable {
arn
}
vpc {
arn
}
rdsDbInstance {
arn
}
eksCluster {
arn
}
ecsService {
arn
}
}
vpc {
id
accountId
arn
region
defaultVpc
dhcpOptionsSet
enableDnsHostnames
enableDnsSupport
instanceTenancy
ipV4Cidr
ipV6Cidr
state
tags {
id
key
value
}
alb {
arn
}
eip {
arn
}
igw {
arn
}
lambda {
arn
}
nacl {
arn
}
natGateway {
arn
}
networkInterface {
arn
}
rdsDbInstance {
arn
}
redshiftCluster {
arn
}
route53HostedZone {
arn
}
routeTable {
arn
}
subnet {
arn
}
eksCluster {
arn
}
ecsService {
arn
}
}
}
}