Control: RDS DB instances with a low number connections per day should be reviewed
These databases have had very little usage in the last 30 days and should be shut down when not in use.
steampipe check alicloud_thrifty.control.rds_db_instance_low_connection_count
Plugins & Tables
|$1||rds_db_instance_avg_connections||The minimum number of average connections per day required for DB instances to be considered in-use.|
with rds_db_usage as (selectdb_instance_id,round(sum(maximum)/count(maximum)) as avg_max,count(maximum) as daysfromalicloud_rds_instance_metric_connections_dailywheredate_part('day', now() - timestamp) <=30group bydb_instance_id)selectarn as resource,casewhen avg_max is null then 'error'when avg_max = 0 then 'alarm'when avg_max < $1 then 'info'else 'ok'end as status,casewhen avg_max is null then 'Cloud monitor metrics not available for ' || title || '.'when avg_max = 0 then title || ' has not been connected to in the last ' || days || ' days.'else title || ' is averaging ' || avg_max || ' max connections/day in the last ' || days || ' days.'end as reason,region,account_idfromalicloud_rds_instance as ileft join rds_db_usage as u on u.db_instance_id = i.db_instance_id;