Control: Long running EC2 instances should be reviewed
Description
Instances should ideally be ephemeral and rehydrated frequently, check why these instances have been running for so long.
Usage
Run the control in your terminal:
powerpipe control run aws_thrifty.control.long_running_ec2_instancesSnapshot and share results via Turbot Pipes:
powerpipe loginpowerpipe control run aws_thrifty.control.long_running_ec2_instances --shareSteampipe Tables
SQL
select arn as resource, case when date_part('day', now()-launch_time) > $1 then 'alarm' else 'ok' end as status, title || ' has been running ' || date_part('day', now()-launch_time) || ' days.' as reason , region, account_idfrom aws_ec2_instancewhere -- Instance is running instance_state in ('running', 'pending', 'rebooting');
Params
| Args | Name | Default | Description | Variable |
|---|---|---|---|---|
| $1 | ec2_running_instance_age_max_days | | The maximum number of days instances are allowed to run. |