turbot/aws_compliance

Query: ec2_stopped_instance_30_days

Usage

powerpipe query aws_compliance.query.ec2_stopped_instance_30_days

Steampipe Tables

SQL

select
arn as resource,
case
when instance_state not in ('stopped', 'stopping') then 'skip'
when state_transition_time <= (current_date - interval '30' day) then 'alarm'
else 'ok'
end as status,
case
when instance_state not in ('stopped', 'stopping') then title || ' is in ' || instance_state || ' state.'
else title || ' stopped since ' || to_char(state_transition_time , 'DD-Mon-YYYY') || ' (' || extract(day from current_timestamp - state_transition_time) || ' days).'
end as reason
, region, account_id
from
aws_ec2_instance;

Controls

The query is being used by the following controls: