website logo
HomeGithubSlack
⌘K
Overview
Quick Start
Supported Services
Running CloudGraph in EKS
Compliance
Rules Engine
AWS
Querying AWS Data
AWS Policy Packs
Billing Data
Services
Azure
Querying Azure Data
Azure Policy Packs
Services
GCP
Querying GCP Data
GCP Policy Packs
Services
K8s
Querying Kubernetes Data
Services
Docs powered by
Archbee
AWS
Services

RDS Db Cluster

18min

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 RDS DB Cluster

GraphQL
|
query {
  queryawsRdsCluster {
    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
      # Other fields and connections here...
    }
    securityGroups {
      arn
      # Other fields and connections here...
    }
  }
}


Filtering

Get data for a single RDS DB Cluster that you know the ARN for:

GraphQL
|
query {
  getawsRdsCluster(arn: "arn:12345") {
    arn
    # Other fields and connections here...
  }
}


Get data for all of the RDS DB Clusters in a certain AWS account:

GraphQL
|
query {
  queryawsRdsCluster(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
# 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
# globalWriteForwardingRequested

# 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 RDS DB Clusters that are NOT in a certain AWS account:

GraphQL
|
query {
  queryawsRdsCluster(filter: { not: { accountId: { eq: "12345" } } }) {
    arn
    # Other fields and connections here...
  }
}


Advanced Filtering

Get data for all of the RDS DB Clusters that have RDS DB Instances:

GraphQL
|
query {
  queryawsRdsCluster(filter: { has: instances }) {
    arn
    # Other fields and connections here...
  }
}

# Note that in addition to "instances" you can filter
# Using "has" based on any of the following attributes:

# 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
# globalWriteForwardingRequested
# securityGroups


Use multiple filter selectors, (i.e. has, and, not, or) to get data for all of the RDS DB Clusters that have Tags AND RDS DB Instances OR that do not have a KMS Key. Note that you can use has, and, not, or completely independently of each other:

GraphQL
|
query {
  queryawsRdsCluster(
    filter: { has: tags, and: { has: instances }, or: { not: { has: kmsKey } } }
  ) {
    arn
    # Other fields and connections here...
  }
}


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:

GraphQL
|
query {
  queryawsRdsCluster(filter: { engineVersion: { regexp: "/.*11.1.*/" } }) {
    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 {
  queryawsRdsCluster(order: { desc: engineVersion }) {
    engineVersion
    # Other fields and connections here...
  }
}

# Note that in addition to "engineVersion" you can filter
# Using "asc" or "desc" based on any of the following attributes:

# id
# accountId
# arn
# allocatedStorage
# backupRetentionPeriod
# characterSetName
# databaseName
# dbClusterIdentifier
# subnets
# status
# percentProgress
# readerEndpoint
# engine
# port
# username
# replicationSourceIdentifier
# hostedZoneId
# kmsKey
# resourceId
# cloneGroupId
# createdTime
# capacity
# engineMode


Only select and return the first two RDS DB Clusters that are found:

GraphQL
|
query {
  queryawsRdsCluster(first: 2, order: { desc: engineVersion }) {
    engineVersion
    # Other fields and connections here...
  }
}


Only select and return the first two RDS DB Clusters that are found, but offset by one so RDS DB Clusters two & three are returned:

GraphQL
|
query {
  queryawsRdsCluster(first: 2, order: { desc: engineVersion }, offset: 1) {
    engineVersion
    # Other fields and connections here...
  }
}


Aggregation

Count the number RDS DB Clusters across all scanned AWS accounts:

GraphQL
|
query {
  aggregateawsRdsCluster {
    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 RDS DB Clusters:

# idMin
# idMax
# accountIdMin
# accountIdMax
# arnMin
# arnMax
# allocatedStorageMin
# allocatedStorageMax
# allocatedStorageSum
# allocatedStorageAvg
# backupRetentionPeriodMin
# backupRetentionPeriodMax
# backupRetentionPeriodSum
# backupRetentionPeriodAvg
# characterSetNameMin
# characterSetNameMax
# databaseNameMin
# databaseNameMax
# dbClusterIdentifierMin
# dbClusterIdentifierMax
# subnetsMin
# subnetsMax
# statusMin
# statusMax
# percentProgressMin
# percentProgressMax
# readerEndpointMin
# readerEndpointMax
# engineMin
# engineMax
# engineVersionMin
# engineVersionMax
# portMin
# portMax
# portSum
# portAvg
# usernameMin
# usernameMax
# replicationSourceIdentifierMin
# replicationSourceIdentifierMax
# hostedZoneIdMin
# hostedZoneIdMax
# kmsKeyMin
# kmsKeyMax
# resourceIdMin
# resourceIdMax
# cloneGroupIdMin
# cloneGroupIdMax
# createdTimeMin
# createdTimeMax
# capacityMin
# capacityMax
# capacitySum
# capacityAvg
# engineModeMin
# engineModeMax


Count the number RDS DB Clusters in a single account. Note that you can apply all of the same filters that are listed above to aggregate queries:

GraphQL
|
query {
  aggregateawsRdsCluster(filter: { accountId: { eq: "12345" } }) {
    count
    # Other fields and connections here...
  }
}


Examples

For each Aurora Postgres RDS DB Cluster running on Postgres version 11.x without deletion protection enabled in AWS Account 12345, get the encryption status and check to see if the database is publicly accessible:

GraphQL
|
query {
  queryawsRdsCluster(
    filter: {
      accountId: { eq: "12345" }
      engine: { eq: "aurora-postgresql" }
      engineVersion: { regexp: "/^11.*/" }
      deletionProtection: false
    }
  ) {
    arn
  }
}


Find all of the RDS DB Clusters that have a tag of Environment:Production for a single AWS Account:

GraphQL
|
query {
  queryawsTag(
    filter: { key: { eq: "Environment" }, value: { eq: "Production" } }
  ) {
    rdsCluster(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 {
  queryawsRdsCluster(
    filter: {
      accountId: { eq: "12345" }
      engine: { eq: "aurora-postgresql" }
      engineVersion: { regexp: "/^11.*/" }
      deletionProtection: false
    }
  ) {
    arn
  }
  queryawsTag(
    filter: { key: { eq: "Environment" }, value: { eq: "Production" } }
  ) {
    rdsCluster(filter: { accountId: { eq: "12345" } }) {
      arn
      # Other fields and connections here...
    }
  }
}


Kitchen Sink

Putting it all together; get all data for all RDS DB Clusters 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 Clusters but if you want to it's easy to go from say, RDS DB Cluster -> RDS DB Instance -> SG...etc:

GraphQL
|
query {
  queryawsRdsCluster {
    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 {
      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
        # Other fields and connections here...
      }
      securityGroups {
        arn
        # Other fields and connections here...
      }
      subnet {
        arn
        # Other fields and connections here...
      }
      vpc {
        arn
        # Other fields and connections here...
      }
    }
    securityGroups {
      id
      accountId
      arn
      name
      vpcId
      description
      tags {
        id
        key
        value
      }
      owner
      default
      inboundRules {
        id
        # Other fields and connections here...
      }
      outboundRules {
        id
        # Other fields and connections here...
      }
      inboundRuleCount
      outboundRuleCount
      alb {
        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...
      }
    }
  }
}


References

Dgraph documentation on querying

AWS RDS DB Cluster documentation

Updated 03 Mar 2023
Did this page help you?
PREVIOUS
Network Interface
NEXT
RDS Db Instance
Docs powered by
Archbee
TABLE OF CONTENTS
Overview
Filtering
Advanced Filtering
Ordering
Aggregation
Examples
Kitchen Sink
References
Docs powered by
Archbee