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 ALB
GraphQL
|
query{queryawsAlb{idaccountIdarnnameregiondnsNameschemetypesubnetshostedZonedefaultVpcipAddressTypeidleTimeoutdeletionProtectionhttp2accessLogsEnableddropInvalidHeaderFieldscreatedAtstatuslisteners{arnsettings{sslPolicyprotocolrules{typeordertargetGroupArn}}}tags{idkeyvalue}securityGroups{arn# Other fields and connections here...}ec2Instance{arn# Other fields and connections here...}vpc{arn# Other fields and connections here...}route53Record{id# Other fields and connections here...}subnet{arn# Other fields and connections here...}}}
Filtering
Get data for a single AWS ALB key that you know the ID or arn for:
GraphQL
|
query{getawsAlb(id:"12345"){arn# Other fields and connections here...}}
GraphQL
|
query{getawsAlb(arn:"arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188"){arn# Other fields and connections here...}}
Get data for all of the ALBs in a certain AWS account:
GraphQL
|
query{queryawsAlb(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# dnsName# scheme# type# subnets# hostedZone# defaultVpc# ipAddressType# idleTimeout# deletionProtection# http2# accessLogsEnabled# dropInvalidHeaderFields# createdAt# status# And the following Dgraph filters can also be applied:# has# and# or# not# regexp (regular expressions)
// fulltextfilters# alloftext# anyoftext
Get data for all of the ALBs that are NOT in a certain AWS account:
GraphQL
|
query{queryawsAlb(filter:{not:{accountId:{eq:"12345"}}}){arn# Other fields and connections here...}}
Advanced Filtering
Get data for all of the ALBs that have a connected subnet:
GraphQL
|
query{queryawsAlb(filter:{has:subnet}){arn# Other fields and connections here...}}# Note that in addition to "subnet" you can filter# Using "has" based on any of the following attributes:# dnsName# scheme# type# subnets# hostedZone# defaultVpc# ipAddressType# idleTimeout# deletionProtection# http2# accessLogsEnabled# dropInvalidHeaderFields# status# listeners# tags# securityGroups# ec2Instance# vpc# route53Record
Use multiple filter selectors, (i.e. has, and, not, or) to get data for all of the ALBs that have subnets AND security groups connected to them OR that do not have route53Records connected to them. Note that you can use has, and, not, or completely independently of each other:
GraphQL
|
query{queryawsAlb(filter:{has:subnetand:{has:securityGroups}or:{not:{has:route53Record}}}){arn# Other fields and connections here...}}
You may also filter using a regex when filtering on a string field like, type if you want to look for a value that matches say, internet-facing:
GraphQL
|
query{queryawsAlb(filter:{type:{regexp:"/.*internet-facing*/"}}){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{queryawsAlb(order:{desc:createdAt}){arn# Other fields and connections here...}}# Note that in addition to "createdAt" you can filter# Using "asc" or "desc" based on any of the following attributes:# id# accountId# arn# region# dnsName# scheme# type# hostedZone# defaultVpc# ipAddressType# idleTimeout# deletionProtection# http2# accessLogsEnabled# dropInvalidHeaderFields# status
Only select and return the first two ALBs that are found:
GraphQL
|
query{queryawsAlb(first:2,order:{desc:createdAt}){arn# Other fields and connections here...}}
Only select and return the first two ALBs that are found, but offset by one so keys two & three are returned:
GraphQL
|
query{queryawsAlb(first:2,order:{desc:createdAt},offset:1){arn# Other fields and connections here...}}
Aggregation
Count the number ALBs across all scanned AWS accounts:
GraphQL
|
query{aggregateawsAlb{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 ALBs:# idMin# idMax# accountIdMin# accountIdMax# arnMin# arnMax# nameMin# nameMax# regionMin# regionMax# dnsNameMin# dnsNameMax# schemeMin# schemeMax# typeMin# typeMax# hostedZoneMin# hostedZoneMax# defaultVpcMin# defaultVpcMax# ipAddressTypeMin# ipAddressTypeMax# idleTimeoutMin# idleTimeoutMax# deletionProtectionMin# deletionProtectionMax# http2Min# http2Max# accessLogsEnabledMin# accessLogsEnabledMax# dropInvalidHeaderFieldsMin# dropInvalidHeaderFieldsMax# statusMin# statusMax
Count the number of ALBs in a single account. Note that you can apply all of the same filters that are listed above to aggregate queries:
GraphQL
|
query{aggregateawsAlb(filter:{accountId:{eq:"12345"}}){count# Other fields and connections here...}}
Examples
Find all of the ALBs that are in the us-east-1 region across all your accounts:
GraphQL
|
query{queryawsAlb(filter:{region:{eq:"us-east-1"}}){arn# Other fields and connections here...}}
Find all of the ALBs that have a tag of Environment:Production for a single AWS Account:
GraphQL
|
query{queryawsTag(filter:{key:{eq:"Environment"},value:{eq:"Production"}}){alb(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{queryawsAlb(filter:{region:{eq:"us-east-1"}}){arn# Other fields and connections here...}queryawsTag(filter:{key:{eq:"Environment"},value:{eq:"Production"}}){alb(filter:{accountId:{eq:"12345"}}){arn# Other fields and connections here...}}}
Kitchen Sink
Putting it all together; get all data for all ALBss 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 keys but if you want to it's easy to go from say, alb -> vpc -> lambda ...etc:
GraphQL
|
query{queryawsAlb{idaccountIdarnnameregiondnsNameschemetypesubnetshostedZonedefaultVpcipAddressTypeidleTimeoutdeletionProtectionhttp2accessLogsEnableddropInvalidHeaderFieldscreatedAtstatuslisteners{arnsettings{sslPolicyprotocolrules{typeordertargetGroupArn}}}tags{idkeyvalue}securityGroups{idaccountIdarnnamevpcIddescriptiontags{idkeyvalue}ownerdefaultinboundRules{id# Other fields and connections here...}outboundRules{id# Other fields and connections here...}inboundRuleCountoutboundRuleCountalb{arn# Other fields and connections here...}lambda{arn# Other fields and connections here...}elb{arn# Other fields and connections here...}ec2Instance{arn# Other fields and connections here...}asg{arn# Other fields and connections here...}rdsCluster{arn# Other fields and connections here...}rdsDbInstance{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...}}ec2Instance{idaccountIdarnregionamitenancyelasticIpspublicDnsprivateDnsmonitoringprivateIpskeyPair{id}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...}}route53Record{idaccountIdzoneIdtypettlrecordsalias{zoneIdnameevaluateTargetHealth}route53HostedZone{arn# Other fields and connections here...}elb{arn# Other fields and connections here...}alb{arn# Other fields and connections here...}restApi{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...}}}}