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 VPN Gateway
query{
queryawsVpnGateway {
id
accountId
arn
region
type
state
amazonSideAsn
vpcIds
tags {
id
key
value
}
vpc {
arn
}
vpnConnection {
arn
}
}
}
Get data for a single AWS VPN Gateway that you know the ID or arn for:
query {
getawsVpnGateway(id: "12345") {
arn
}
}
query {
getawsVpnGateway(arn: "arn:aws:ec2:us-east-1:111122223333:vpn-gateway/vpn-gtw-11122223333f466ec") {
arn
}
}
Get data for all of the VPN Gateways in a certain AWS account:
query {
queryawsVpnGateway(filter: { accountId: { eq: "12345" } }) {
arn
}
}
Get data for all of the VPN Gateways that are NOT in a certain AWS account:
query {
queryawsVpnGateway(filter: { not: { accountId: { eq: "12345" } } }) {
arn
}
}
Get data for all of the VPN Gateways that have a connected vpc:
query {
queryawsVpnGateway(filter: { has: vpc }) {
arn
}
}
Use multiple filter selectors, (i.e. has, and, not, or) to get data for all of the VPN Gateways that have a VPC AND transitGatewayAttachment connected to them OR that do not have tags. Note that you can use has, and, not, or completely independently of each other:
query {
queryawsTransitGateway(
filter: {
has: vpnConnection
and: { has: transitGatewayAttachment }
or: { not: { has: tags } }
}
) {
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 VPN Gateways in us regions:
query {
queryawsVpnGateway(filter: { region: { regexp: "/.*us-*/" } }) {
arn
}
}
You can order the results you get back either asc or desc depending on your preference:
query {
queryawsVpnGateway(order: { desc: region }) {
arn
}
}
Only select and return the first two VPN Gateway that are found:
query {
queryawsVpnGateway(first: 2, order: { desc: region }) {
arn
}
}
Only select and return the first two VPN Gateways that are found, but offset by one so VPN Gateways two & three are returned:
query {
queryawsVpnGateway(first: 2, order: { desc: region }, offset: 1) {
arn
}
}
Count the number VPN Gateways across all scanned AWS accounts:
query {
aggregateawsVpnGateway {
count
}
}
Count the number of VPN Gateways in a single account. Note that you can apply all of the same filters that are listed above to aggregate queries:
query {
aggregateawsVpnGateway(filter: { accountId: { eq: "12345" } }) {
count
}
}
Find all of the VPN Gateways that are in the us-east-1 region across all your accounts:
query {
queryawsVpnGateway(filter: { region: { eq: "us-east-1" } }) {
arn
}
}
Putting it all together; get all data for all VPN 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 vpn gateways but if you want to it's easy to go from say, vpnGateway -> vpnConnection -> customerGateway ...etc:
query{
queryawsVpnGateway {
id
accountId
arn
region
type
state
amazonSideAsn
vpcIds
tags {
id
key
value
}
vpc {
accountId
arn
defaultVpc
dhcpOptionsSet
enableDnsHostnames
enableDnsSupport
id
instanceTenancy
ipV4Cidr
ipV6Cidr
state
alb {
arn
}
eip {
arn
}
elb {
arn
}
igw {
arn
}
tags {
id
key
value
}
nacl {
arn
}
lambda {
arn
}
subnet {
arn
}
natGateway {
arn
}
routeTable {
arn
}
rdsDbInstance {
arn
}
route53HostedZone {
arn
}
}
vpnConnection {
id
accountId
arn
region
category
customerGatewayId
state
type
vpnGatewayId
transitGatewayId
options {
id
enableAcceleration
staticRoutesOnly
localIpv4NetworkCidr
remoteIpv4NetworkCidr
tunnelInsideIpVersion
type
tunnelOptions {
id
outsideIpAddress
tunnelInsideCidr
preSharedKey
}
}
routes {
id
destinationCidrBlock
source
state
}
vgwTelemetry {
id
acceptedRouteCount
lastStatusChange
certificateArn
outsideIpAddress
status
statusMessage
}
tags {
id
key
value
}
transitGateway {
arn
}
customerGateway {
arn
}
vpnGateway {
arn
}
transitGatewayAttachment {
arn
}
}
}
}