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.
Overview
You can currently query the following attributes and connections on an AWS NACL
GraphQL
|
query{queryawsNetworkInterface{idaccountIdarnregionsubnetIdmacAddressdescriptionavailabilityZonestatusvpcIdinterfaceTypesecurityGroupsprivateDnsNameprivateIpsattachment{idattachmentIddeleteOnTerminationstatus}tags{idkeyvalue}ec2Instance{arn# Other fields and connections here...}eip{arn# Other fields and connections here...}natGateway{arn# Other fields and connections here...}subnet{arn# Other fields and connections here...}vpc{arn# Other fields and connections here...}}}
Filtering
Get data for a single AWS Network Interface that you know the ID or arn for:
GraphQL
|
query{getawsNetworkInterface(id:"12345"){arn# Other fields and connections here...}}
GraphQL
|
query{getawsNetworkInterface(arn:"arn:aws:ec2:sa-east-1:111122223333:network-interface/eni-234532"){arn# Other fields and connections here...}}
Get data for all of the Network Interfaces in a certain AWS account:
GraphQL
|
query{queryawsNetworkInterface(filter:{accountId:{eq:"12345"}}){arn# Other fields and connections here...}}# Note that in addition to "accountId" you can# Filter based on any of the following attributes:# id# arn# region# subnetId# macAddress# description // can use fulltext filters# availabilityZone# status# vpcId# interfaceType# securityGroups# privateDnsName# privateIps# And the following Dgraph filters can also be applied:# has# and# or# not# regexp (regular expressions)# fulltext filters# alloftext# anyoftext
Get data for all of the Network Interfaces that are NOT in a certain AWS account:
GraphQL
|
query{queryawsNetworkInterface(filter:{not:{accountId:{eq:"12345"}}}){arn# Other fields and connections here...}}
Advanced Filtering
Get data for all of the Network Interfaces that have a connected vpc:
GraphQL
|
query{queryawsNetworkInterface(filter:{has:vpc}){arn# Other fields and connections here...}}# Note that in addition to "vpc" you can filter# Using "has" based on any of the following attributes:# subnet# natGateway# eip# ec2Instance# tags# privateIps# securityGroups# description# macAddress# privateDnsName# attachment
Use multiple filter selectors, (i.e. has, and, not, or) to get data for all of the Network Intefaces that have vpc instances AND subnets connected to them OR that do not have ec2 instances connected to them. Note that you can use has, and, not, or completely independently of each other:
GraphQL
|
query{queryawsNetworkInterface(filter:{has:vpcand:{has:subnet}or:{not:{has:ec2Instance}}}){arn# Other fields and connections here...}}
You may also filter using a regex when filtering on a string field like, description if you want to look for an id that matches say, not secure:
GraphQL
|
query{queryawsNetworkInterface(filter:{description:{regexp:"/.*not secure*/"}}){arn# Other fields and connections here...}}
Ordering
You can order the results you get back either asc or desc depending on your preference:
GraphQL
|
query{queryawsNetworkInterface(order:{desc:region}){arn# Other fields and connections here...}}# Note that in addition to "region" you can filter# Using "asc" or "desc" based on any of the following attributes:# id# accountId# arn# subnetId# macAddress# description# availabilityZone# status# vpcId# interfaceType# privateDnsName
Only select and return the first two Network Interfaces that are found:
GraphQL
|
query{queryawsNetworkInterface(first:2,order:{desc:region}){arn# Other fields and connections here...}}
Only select and return the first two Network Interfaces that are found, but offset by one so networks two & three are returned:
GraphQL
|
query{queryawsNetworkInterface(first:2,order:{desc:region},offset:1){arn# Other fields and connections here...}}
Aggregation
Count the number Network Interfaces across all scanned AWS accounts:
GraphQL
|
query{aggregateawsNetworkInterface{count# Other fields and connections here...}}# Note that in addition to "count" you can request the# Following min and max values based on attributes of your Network Interfaces:# idMin# idMax# accountIdMin# accountIdMax# arnMin# arnMax# regionMin# regionMax# subnetIdMin# subnetIdMax# macAddressMin# macAddressMax# descriptionMin# descriptionMax# availabilityZoneMin# availibilityZoneMax# statusMin# statusMax# vpcIdMin# vpcIdMax# interfaceTypeMin# interfaceTypeMax# privateDnsNameMin# privateDnsNameMax
Count the number of Network Interfaces in a single account. Note that you can apply all of the same filters that are listed above to aggregate queries:
GraphQL
|
query{aggregateawsNetworkInterface(filter:{accountId:{eq:"12345"}}){count# Other fields and connections here...}}
Examples
Find all of the Network Interfaces that are in the us-east-1 region across all your accounts:
GraphQL
|
query{queryawsNetworkInterface(filter:{region:{eq:"us-east-1"}}){arn# Other fields and connections here...}}
Find all of the Network Interfaces that have a tag of Environment:Production for a single AWS Account:
GraphQL
|
query{queryawsTag(filter:{key:{eq:"Environment"},value:{eq:"Production"}}){networkInterface(filter:{accountId:{eq:"12345"}}){arn# Other fields and connections here...}}}
With CloudGraph you can run multiple queries at the same time so you can combine the above two queries if you like:
GraphQL
|
query{queryawsNetworkInterface(filter:{region:{eq:"us-east-1"}}){arn# Other fields and connections here...}queryawsTag(filter:{key:{eq:"Environment"},value:{eq:"Production"}}){networkInterface(filter:{accountId:{eq:"12345"}}){arn# Other fields and connections here...}}}
Kitchen Sink
Putting it all together; get all data for all NACLs 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 networks but if you want to it's easy to go from say, nacl -> vpc -> lambda ...etc:
GraphQL
|
query{queryawsNetworkInterface{idaccountIdarnregionsubnetIdmacAddressdescriptionavailabilityZonestatusvpcIdinterfaceTypesecurityGroupsprivateDnsNameprivateIpsattachment{idattachmentIddeleteOnTerminationstatus}tags{idkeyvalue}ec2Instance{idaccountIdarnregionamitenancyelasticIpspublicDnsprivateDnsmonitoringprivateIpskeyPair{idnamefingerprint}cpuCoreCounthibernationebsOptimizedipv4PublicIpinstanceTypeipv6AddressesplacementGroupinstanceStatesourceDestCheckavailabilityZonecpuThreadsPerCoreiamInstanceProfiledeletionProtectiondailyCost{costcurrencyformattedCost}primaryNetworkInterfacemetadataOptions{state# Other fields and connections here...}metadatasecurityGroupIdsOptionssecurityGroupIdsephemeralBlockDevices{deviceName# Other fields and connections here...}tags{idkeyvalue}alb{arn# Other fields and connections here...}asg{arn# Other fields and connections here...}ebs{arn# Other fields and connections here...}eip{arn# Other fields and connections here...}networkInterfaces{arn# Other fields and connections here...}securityGroups{arn# Other fields and connections here...}subnet{arn# Other fields and connections here...}}eip{idaccountIdarnregionvpcdomainpublicIpprivateIpinstanceIdpublicIpv4PoolnetworkInterfaceIdec2InstanceAssociationIdnetworkInterfaceOwnerIdnetworkBorderGroupcustomerOwnedIpcustomerOwnedIpv4Pooltags{idkeyvalue}vpcs{arn# Other fields and connections here...}ec2Instance{arn# Other fields and connections here...}networkInterface{arn# Other fields and connections here...}}natGateway{idaccountIdarnregionstatecreateTimedailyCost{costcurrencyformattedCost}tags{idkeyvalue}networkInterface{arn# Other fields and connections here...}subnet{arn# Other fields and connections here...}vpc{arn# Other fields and connections here...}}subnet{idaccountIdarnautoAssignPublicIpv4AddressautoAssignPublicIpv6AddressavailabilityZoneavailableIpV4AddressesdefaultForAzipV4CidripV6Cidrstatetags{idkeyvalue}alb{arn# Other fields and connections here...}asg{arn# Other fields and connections here...}ec2Instance{arn# Other fields and connections here...}elb{arn# Other fields and connections here...}lambda{arn# Other fields and connections here...}natGateway{arn# Other fields and connections here...}networkInterface{arn# Other fields and connections here...}routeTable{arn# Other fields and connections here...}vpc{arn# Other fields and connections here...}rdsDbInstance{arn# Other fields and connections here...}}vpc{idaccountIdarnregiondefaultVpcdhcpOptionsSetenableDnsHostnamesenableDnsSupportinstanceTenancyipV4CidripV6Cidrstatetags{idkeyvalue}alb{arn# Other fields and connections here...}eip{arn# Other fields and connections here...}igw{arn# Other fields and connections here...}lambda{arn# Other fields and connections here...}nacl{arn# Other fields and connections here...}natGateway{arn# Other fields and connections here...}networkInterface{arn# Other fields and connections here...}rdsDbInstance{arn# Other fields and connections here...}redshiftCluster{arn# Other fields and connections here...}route53HostedZone{arn# Other fields and connections here...}routeTable{arn# Other fields and connections here...}subnet{arn# Other fields and connections here...}eksCluster{arn# Other fields and connections here...}ecsService{arn# Other fields and connections here...}}}}