turbot/aws_compliance

Query: directory_service_directory_snapshots_limit_2

Usage

powerpipe query aws_compliance.query.directory_service_directory_snapshots_limit_2

SQL

select
arn as resource,
case
when snapshot_limit ->> 'ManualSnapshotsLimitReached' = 'true' then 'alarm'
when (
(snapshot_limit ->> 'ManualSnapshotsLimit') :: int - (snapshot_limit ->> 'ManualSnapshotsCurrentCount') :: int
) <= 2 then 'alarm'
else 'ok'
end as status,
case
when snapshot_limit ->> 'ManualSnapshotsLimitReached' = 'true' then title || ' has reached ' || (snapshot_limit ->> 'ManualSnapshotsLimit') || ' snapshots limit.'
when (
(snapshot_limit ->> 'ManualSnapshotsLimit') :: int - (snapshot_limit ->> 'ManualSnapshotsCurrentCount') :: int
) <= 2 then title || ' is about to reach its ' || (snapshot_limit ->> 'ManualSnapshotsLimit') || ' snapshot limit.'
else title || ' is using ' || (snapshot_limit ->> 'ManualSnapshotsCurrentCount') || ' out of ' || (snapshot_limit ->> 'ManualSnapshotsLimit') || ' snapshots limit.'
end as reason,
region,
account_id
from
aws_directory_service_directory;

Controls

The query is being used by the following controls: