turbot/steampipe-mod-aws-compliance

Control: KMS keys should not be pending deletion

Description

To help protect data at rest, ensure necessary customer master keys (CMKs) are not scheduled for deletion in AWS Key Management Service (AWS KMS).

Usage

Run the control in your terminal:

powerpipe control run aws_compliance.control.kms_key_not_pending_deletion

Snapshot and share results via Turbot Pipes:

powerpipe login
powerpipe control run aws_compliance.control.kms_key_not_pending_deletion --share

SQL

This control uses a named query:

select
arn as resource,
case
when key_state = 'PendingDeletion' then 'alarm'
else 'ok'
end as status,
case
when key_state = 'PendingDeletion' then title || ' scheduled for deletion and will be deleted in ' || extract(day from deletion_date - current_timestamp) || ' day(s).'
else title || ' not scheduled for deletion.'
end as reason
, region, account_id
from
aws_kms_key
where
key_manager = 'CUSTOMER';

Tags