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 Transit Gateway Attachment
GraphQL
|
query{queryawsTransitGatewayAttachment{idaccountIdarnregiontransitGatewayIdtransitGatewayOwnerIdresourceOwnerIdresourceTyperesourceIdstatetransitGatewayRouteTableIdcreationTimetags{idkeyvalue}routeTable{arn# Other fields and connections here...}transitGateway{arn# Other fields and connections here...}vpc{arn# Other fields and connections here...}vpnConnection{arn# Other fields and connections here...}}}
Filtering
Get data for a single AWS Transit Gateway Attachment that you know the ID or arn for:
GraphQL
|
query{getawsTransitGatewayAttachment(id:"12345"){arn# Other fields and connections here...}}
GraphQL
|
query{getawsTransitGatewayAttachment(arn:"arn:aws:ec2:us-east-1:111122223333:transit-gateway-attachment/tgw-attach-11122223333f466ec"){arn# Other fields and connections here...}}
Get data for all of the Transit Gateway Attachments in a certain AWS account:
GraphQL
|
query{queryawsTransitGatewayAttachment(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# transitGatewayId# transitGatewayOwnerId# resourceOwnerId# resourceType# resourceId# state# transitGatewayRouteTableId# creationTime# And the following Dgraph filters can also be applied:# has# and# or# not# regexp (regular expressions)
Get data for all of the Transit Gateway Attachments that are NOT in a certain AWS account:
GraphQL
|
query{queryawsTransitGatewayAttachment(filter:{not:{accountId:{eq:"12345"}}}){arn# Other fields and connections here...}}
Advanced Filtering
Get data for all of the Transit Gateway Attachments that have a connected vpnConnection:
GraphQL
|
query{queryawsTransitGatewayAttachment(filter:{has:vpnConnection}){arn# Other fields and connections here...}}# Note that in addition to "vpnConnection" you can filter# Using "has" based on any of the following attributes:# id# accountId# arn# region# transitGatewayId# transitGatewayOwnerId# resourceOwnerId# resourceType# resourceId# state# transitGatewayRouteTableId# creationTime# tags# routeTable# transitGateway# vpc
Use multiple filter selectors, (i.e. has, and, not, or) to get data for all of the Transit Gateway Attachments that have vpnConnection instances AND vpc instances connected to them OR that do not have routeTable instances connected to them. Note that you can use has, and, not, or completely independently of each other:
GraphQL
|
query{queryawsTransitGatewayAttachment(filter:{has:vpnConnectionand:{has:vpc}or:{not:{has:routeTable}}}){arn# Other fields and connections here...}}
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 Transit Gateway Attachments in us regions:
GraphQL
|
query{queryawsTransitGatewayAttachment(filter:{region:{regexp:"/.*us-*/"}}){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{queryawsTransitGatewayAttachment(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# transitGatewayId# transitGatewayOwnerId# resourceOwnerId# resourceType# resourceId# state# transitGatewayRouteTableId# creationTime
Only select and return the first two Transit Gateway Attachments that are found:
GraphQL
|
query{queryawsTransitGatewayAttachment(first:2,order:{desc:region}){arn# Other fields and connections here...}}
Only select and return the first two Transit Gateway Attachments that are found, but offset by one so Transit Gateway Attachments two & three are returned:
GraphQL
|
query{queryawsTransitGatewayAttachment(first:2,order:{desc:region},offset:1){arn# Other fields and connections here...}}
Aggregation
Count the number Transit Gateway Attachments across all scanned AWS accounts:
GraphQL
|
query{aggregateawsTransitGatewayAttachment{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 Transit Gateway Attachment:# idMin# idMax# accountIdMin# accountIdMax# arnMin# arnMax# regionMin# regionMax# transitGatewayIdMin# transitGatewayIdMax# transitGatewayOwnerIdMin# transitGatewayOwnerIdMax# resourceOwnerIdMin# resourceOwnerIdMax# resourceTypeMin# resourceTypeMax# resourceIdMin# resourceIdMax# stateMin# stateMax# transitGatewayRouteTableIdMin# transitGatewayRouteTableIdMax# creationTimeMin# creationTimeMax
Count the number of Transit Gateway Attachments in a single account. Note that you can apply all of the same filters that are listed above to aggregate queries:
GraphQL
|
query{aggregateawsTransitGatewayAttachment(filter:{accountId:{eq:"12345"}}){count# Other fields and connections here...}}
Examples
Find all of the Transit Gateway Attachments that are in the us-east-1 region across all your accounts:
GraphQL
|
query{queryawsTransitGatewayAttachment(filter:{region:{eq:"us-east-1"}}){arn# Other fields and connections here...}}
Kitchen Sink
Putting it all together; get all data for all Transit Gateway Attachments 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 transit gateway attachments but if you want to it's easy to go from say, transitGatewayAttachment -> transitGateway -> routeTable ...etc:
GraphQL
|
query{queryawsTransitGatewayAttachment{idaccountIdarnregiontransitGatewayIdtransitGatewayOwnerIdresourceOwnerIdresourceTyperesourceIdstatetransitGatewayRouteTableIdcreationTimetags{idkeyvalue}routeTable{idaccountIdarnregionvpcIdroutes{id# Other fields and connections here...}mainRouteTableexplicitlyAssociatedWithSubnetsexplicitlyAssociatedWithSubnetstags{idkeyvalue}subnet{arn# Other fields and connections here...}vpc{arn# Other fields and connections here...}transitGateway{arn# Other fields and connections here...}transitGatewayAttachment{arn# Other fields and connections here...}}transitGateway{idaccountIdarnregionownerIddescriptiondnsSupportvpnEcmpSupportamazonSideAsnautoAcceptSharedAttachmentsdefaultRouteTableAssociationassociationDefaultRouteTableIddefaultRouteTableAssociationpropagationDefaultRouteTableIdtags{idkeyvalue}routeTable{arn# Other fields and connections here...}transitGatewayAttachment{arn# Other fields and connections here...}vpnConnection{arn# Other fields and connections here...}}vpc{accountIdarndefaultVpcdhcpOptionsSetenableDnsHostnamesenableDnsSupportidinstanceTenancyipV4CidripV6Cidrstatealb{arn# Other fields and connections here...}eip{arn# Other fields and connections here...}elb{arn# Other fields and connections here...}igw{arn# Other fields and connections here...}tags{idkeyvalue}nacl{arn# Other fields and connections here...}lambda{arn# Other fields and connections here...}subnet{arn# Other fields and connections here...}natGateway{arn# Other fields and connections here...}routeTable{arn# Other fields and connections here...}rdsDbInstance{# Other fields and connections here...arn}route53HostedZone{# Other fields and connections here...arn}}vpnConnection{idaccountIdarnregioncategorycustomerGatewayIdstatetypevpnGatewayIdtransitGatewayIdoptions{idenableAccelerationstaticRoutesOnlylocalIpv4NetworkCidrremoteIpv4NetworkCidrtunnelInsideIpVersiontypetunnelOptions{idoutsideIpAddresstunnelInsideCidrpreSharedKey}}routes{iddestinationCidrBlocksourcestate}vgwTelemetry{idacceptedRouteCountlastStatusChangecertificateArnoutsideIpAddressstatusstatusMessage}tags{idkeyvalue}transitGateway{arn# Other fields and connections here...}customerGateway{arn# Other fields and connections here...}vpnGateway{arn# Other fields and connections here...}transitGatewayAttachment{arn# Other fields and connections here...}}}}