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 RDS DB Instance
query {
queryawsRdsDbInstance {
id
accountId
arn
name
port
address
hostedZoneId
username
resourceId
engine
engineVersion
createdTime
copyTagsToSnapshot
deletionProtection
dBInstanceIdentifier
performanceInsightsEnabled
autoMinorVersionUpgrade
iamDbAuthenticationEnabled
optionsGroups
parameterGroup
storageType
instanceClass
allocatedStorage
multiAZ
subnetGroup
availabilityZone
publiclyAccessible
certificateAuthority
status
failoverPriority
kmsKey
encrypted
tags {
id
key
value
}
cluster {
arn
}
securityGroups {
arn
}
subnet {
arn
}
vpc {
arn
}
}
}
Get data for a single RDS DB Instance that you know the ARN for:
query {
getawsRdsDbInstance(arn: "arn:12345") {
arn
}
}
Get data for all of the RDS DB Instances in a certain AWS account:
query {
queryawsRdsDbInstance(filter: { accountId: { eq: "12345" } }) {
arn
}
}
Get data for all of the RDS DB Instances that are NOT in a certain AWS account:
query {
queryawsRdsDbInstance(filter: { not: { accountId: { eq: "12345" } } }) {
arn
}
}
Get data for all of the RDS DB Instances that are part of clusters:
query {
queryawsRdsDbInstance(filter: { has: cluster }) {
arn
}
}
Use multiple filter selectors, (i.e. has, and, not, or) to get data for all of the RDS DB Instances that have Tags AND are part of a cluster OR that do not have a Parameter Group. Note that you can use has, and, not, or completely independently of each other:
query {
queryawsRdsDbInstance(
filter: {
has: tags
and: { has: cluster }
or: { not: { has: parameterGroup } }
}
) {
arn
}
}
You may also filter using a regex when filtering on a string field like, engineVersion if you want to look for a value that matches say, 11.1:
query {
queryawsRdsDbInstance(filter: { engineVersion: { regexp: "/.*11.1.*/" } }) {
arn
}
}
You can order the results you get back either asc or desc depending on your preference:
query {
queryawsRdsDbInstance(order: { desc: engineVersion }) {
engineVersion
}
}
Only select and return the first two RDS DB Instances that are found:
query {
queryawsRdsDbInstance(first: 2, order: { desc: engineVersion }) {
engineVersion
}
}
Only select and return the first two RDS DB Instances that are found, but offset by one so RDS DB Instances two & three are returned:
query {
queryawsRdsDbInstance(first: 2, order: { desc: engineVersion }, offset: 1) {
engineVersion
}
}
Count the number RDS DB Instances across all scanned AWS accounts:
query {
aggregateawsRdsDbInstance {
count
}
}
Count the number RDS DB Instances in a single account. Note that you can apply all of the same filters that are listed above to aggregate queries:
query {
aggregateawsRdsDbInstance(filter: { accountId: { eq: "12345" } }) {
count
}
}
For each Aurora Postgres RDS DB Instance running on Postgres version 11.x that has a r5 instance class in AWS Account 12345, get the encryption status and check to see if the database is publicly accessible:
query {
queryawsRdsDbInstance(
filter: {
accountId: { eq: "12345" }
engine: { eq: "aurora-postgresql" }
engineVersion: { regexp: "/^11.*/" }
instanceClass: { regexp: "/r5/" }
}
) {
arn
encrypted
publiclyAccessible
}
}
Find all of the RDS DB Instances that have a tag of Environment:Production for a single AWS Account:
query {
queryawsTag(
filter: { key: { eq: "Environment" }, value: { eq: "Production" } }
) {
rdsDbInstance(filter: { accountId: { eq: "12345" } }) {
arn
}
}
}
With CloudGraph you can run multiple queries at the same time so you can combine the above two queries if you like:
query {
queryawsRdsDbInstance(
filter: {
accountId: { eq: "12345" }
engine: { eq: "aurora-postgresql" }
engineVersion: { regexp: "/^11.*/" }
instanceClass: { regexp: "/r5/" }
}
) {
arn
encrypted
publiclyAccessible
}
queryawsTag(
filter: { key: { eq: "Environment" }, value: { eq: "Production" } }
) {
rdsDbInstance(filter: { accountId: { eq: "12345" } }) {
arn
}
}
}
Putting it all together; get all data for all RDS DB Instances 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 RDS DB Instances but if you want to it's easy to go from say, RDS DB Instance -> Subnet -> VPC...etc:
query {
queryawsRdsDbInstance {
id
accountId
arn
name
port
address
hostedZoneId
username
resourceId
engine
engineVersion
createdTime
copyTagsToSnapshot
deletionProtection
dBInstanceIdentifier
performanceInsightsEnabled
autoMinorVersionUpgrade
iamDbAuthenticationEnabled
optionsGroups
parameterGroup
storageType
instanceClass
allocatedStorage
multiAZ
subnetGroup
availabilityZone
publiclyAccessible
certificateAuthority
status
failoverPriority
kmsKey
encrypted
tags {
id
key
value
}
cluster {
id
accountId
arn
allocatedStorage
backupRetentionPeriod
characterSetName
databaseName
dbClusterIdentifier
subnets
status
percentProgress
readerEndpoint
multiAZ
engine
engineVersion
port
username
replicationSourceIdentifier
hostedZoneId
encrypted
kmsKey
resourceId
iamDbAuthenticationEnabled
cloneGroupId
createdTime
capacity
engineMode
deletionProtection
httpEndpointEnabled
copyTagsToSnapshot
crossAccountClone
tags {
id
key
value
}
globalWriteForwardingRequested
instances {
arn
}
securityGroups {
arn
}
}
securityGroups {
id
accountId
arn
name
vpcId
description
tags {
id
key
value
}
owner
default
inboundRules {
id
}
outboundRules {
id
}
inboundRuleCount
outboundRuleCount
alb {
arn
}
lambda {
arn
}
elb {
arn
}
ec2Instance {
arn
}
asg {
arn
}
rdsCluster {
arn
}
rdsDbInstance {
arn
}
}
subnet {
id
accountId
arn
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
}
}
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
}
}
}
}