Table: aws_dynamodb_tables

This table shows data for Amazon DynamoDB Tables.

https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_TableDescription.html (opens in a new tab)

The primary key for this table is arn.

Relations

The following tables depend on aws_dynamodb_tables:

Columns

NameType
_cq_iduuid
_cq_parent_iduuid
account_idutf8
regionutf8
tagsjson
arn (PK)utf8
archival_summaryjson
attribute_definitionsjson
billing_mode_summaryjson
creation_date_timetimestamp[us, tz=UTC]
deletion_protection_enabledbool
global_secondary_indexesjson
global_table_versionutf8
item_countint64
key_schemajson
latest_stream_arnutf8
latest_stream_labelutf8
local_secondary_indexesjson
provisioned_throughputjson
replicasjson
restore_summaryjson
sse_descriptionjson
stream_specificationjson
table_arnutf8
table_class_summaryjson
table_idutf8
table_nameutf8
table_size_bytesint64
table_statusutf8

Example Queries

These SQL queries are sampled from CloudQuery policies and are compatible with PostgreSQL.

DynamoDB tables should automatically scale capacity with demand

SELECT
  'DynamoDB tables should automatically scale capacity with demand' AS title,
  t.account_id,
  pr.arn AS resource_id,
  CASE
  WHEN t.billing_mode_summary->>'BillingMode' IS DISTINCT FROM 'PAY_PER_REQUEST'
  AND (
      (
        s.replica_provisioned_read_capacity_auto_scaling_settings->>'AutoScalingDisabled'
      )::BOOL
      IS NOT false
      OR (
          s.replica_provisioned_write_capacity_auto_scaling_settings->>'AutoScalingDisabled'
        )::BOOL
        IS NOT false
    )
  AND (pr._cq_id IS NULL OR pw._cq_id IS NULL)
  THEN 'fail'
  ELSE 'pass'
  END
    AS status
FROM
  aws_dynamodb_tables AS t
  LEFT JOIN aws_dynamodb_table_replica_auto_scalings AS s ON s.table_arn = t.arn
  LEFT JOIN aws_applicationautoscaling_policies AS pr ON
      pr.service_namespace = 'dynamodb'
      AND pr.resource_id = concat('table/', t.table_name)
      AND pr.policy_type = 'TargetTrackingScaling'
      AND pr.scalable_dimension = 'dynamodb:table:ReadCapacityUnits'
  LEFT JOIN aws_applicationautoscaling_policies AS pw ON
      pw.service_namespace = 'dynamodb'
      AND pw.resource_id = concat('table/', t.table_name)
      AND pw.policy_type = 'TargetTrackingScaling'
      AND pw.scalable_dimension = 'dynamodb:table:WriteCapacityUnits';

DynamoDB tables should have point-in-time recovery enabled

SELECT
  'DynamoDB tables should have point-in-time recovery enabled' AS title,
  t.account_id,
  t.arn AS resource_id,
  CASE
  WHEN b.point_in_time_recovery_description->>'PointInTimeRecoveryStatus'
  IS DISTINCT FROM 'ENABLED'
  THEN 'fail'
  ELSE 'pass'
  END
    AS status
FROM
  aws_dynamodb_tables AS t
  LEFT JOIN aws_dynamodb_table_continuous_backups AS b ON b.table_arn = t.arn;

DynamoDB table with no items

SELECT
  'DynamoDB table with no items' AS title,
  account_id,
  arn AS resource_id,
  'fail' AS status
FROM
  aws_dynamodb_tables
WHERE
  item_count = 0;