Table: aws_kms_keys

This table shows data for AWS Key Management Service (AWS KMS) Keys.

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

The primary key for this table is arn.

Relations

The following tables depend on aws_kms_keys:

Columns

NameType
_cq_iduuid
_cq_parent_iduuid
account_idutf8
regionutf8
rotation_enabledbool
tagsjson
arn (PK)utf8
replica_keysjson
key_idutf8
aws_account_idutf8
cloud_hsm_cluster_idutf8
creation_datetimestamp[us, tz=UTC]
custom_key_store_idutf8
customer_master_key_specutf8
deletion_datetimestamp[us, tz=UTC]
descriptionutf8
enabledbool
encryption_algorithmslist<item: utf8, nullable>
expiration_modelutf8
key_managerutf8
key_specutf8
key_stateutf8
key_usageutf8
mac_algorithmslist<item: utf8, nullable>
multi_regionbool
multi_region_configurationjson
originutf8
pending_deletion_window_in_daysint64
signing_algorithmslist<item: utf8, nullable>
valid_totimestamp[us, tz=UTC]
xks_key_configurationjson

Example Queries

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

AWS KMS keys should not be unintentionally deleted

SELECT
  'AWS KMS keys should not be unintentionally deleted' AS title,
  account_id,
  arn AS resource_id,
  CASE
  WHEN key_state = 'PendingDeletion' AND key_manager = 'CUSTOMER' THEN 'fail'
  ELSE 'pass'
  END
    AS status
FROM
  aws_kms_keys;

Ensure rotation for customer created custom master keys is enabled (Scored)

SELECT
  'Ensure rotation for customer created custom master keys is enabled (Scored)'
    AS title,
  account_id,
  arn,
  CASE
  WHEN rotation_enabled IS false AND key_manager = 'CUSTOMER' THEN 'fail'
  ELSE 'pass'
  END
FROM
  aws_kms_keys;