Control: Are there any EBS volumes with low usage?
Description
Volumes that are unused should be archived and deleted
Usage
Run the control in your terminal:
powerpipe control run aws_thrifty.control.ebs_with_low_usageSnapshot and share results via Turbot Pipes:
powerpipe loginpowerpipe control run aws_thrifty.control.ebs_with_low_usage --shareSteampipe Tables
SQL
with ebs_usage as (  select    partition,    account_id,    _ctx,    region,    volume_id,    round(avg(max)) as avg_max,    count(max) as days    from (      (        select          partition,          account_id,          _ctx,          region,          volume_id,          cast(maximum as numeric) as max        from          aws_ebs_volume_metric_read_ops_daily        where          date_part('day', now() - timestamp) <= 30      )      UNION      (        select          partition,          account_id,          _ctx,          region,          volume_id,          cast(maximum as numeric) as max        from          aws_ebs_volume_metric_write_ops_daily        where          date_part('day', now() - timestamp) <= 30      )    ) as read_and_write_ops    group by 1,2,3,4,5)select  'arn:' || partition || ':ec2:' || region || ':' || account_id || ':volume/' || volume_id as resource,  case    when avg_max <= $1 then 'alarm'    when avg_max <= $2 then 'info'    else 'ok'  end as status,  volume_id || ' is averaging ' || avg_max || ' read and write ops over the last ' || days || ' days.' as reason  , region, account_idfrom  ebs_usage;
Params
| Args | Name | Default | Description | Variable | 
|---|---|---|---|---|
| $1 | ebs_volume_avg_read_write_ops_low |  | The number of average read/write ops required for volumes to be considered infrequently used. This value should be lower than ebs_volume_avg_read_write_ops_high. | |
| $2 | ebs_volume_avg_read_write_ops_high |  | The number of average read/write ops required for volumes to be considered frequently used. This value should be higher than ebs_volume_avg_read_write_ops_low. |