turbot/aws_thrifty
Loading controls...

Control: Long running ElastiCache clusters should have reserved nodes purchased for them

Description

Long running clusters should be associated with reserved nodes, which provide a significant discount.

Usage

Run the control in your terminal:

powerpipe control run aws_thrifty.control.elasticache_cluster_long_running

Snapshot and share results via Turbot Pipes:

powerpipe login
powerpipe control run aws_thrifty.control.elasticache_cluster_long_running --share

Steampipe Tables

Params

ArgsNameDefaultDescriptionVariable
$1elasticache_running_cluster_age_max_days
90
The maximum number of days clusters are allowed to run.
$2elasticache_running_cluster_age_warning_days
30
The number of days clusters can be running before sending a warning.

SQL

with filter_clusters as (
select
distinct c.replication_group_id as name,
c.cache_cluster_create_time,
c._ctx,
c.region,
c.account_id,
'redis' as engine,
c.partition
from
aws_elasticache_replication_group as rg
left join aws_elasticache_cluster as c on rg.replication_group_id = c.replication_group_id
union
select
cache_cluster_id as name,
cache_cluster_create_time,
_ctx,
region,
account_id,
engine,
partition
from
aws_elasticache_cluster
where
engine = 'memcached'
)
select
'arn:' || partition || ':elasticache:' || region || ':' || account_id || ':cluster:' || name as resource,
case
when date_part('day', now() - cache_cluster_create_time) > $1 then 'alarm'
when date_part('day', now() - cache_cluster_create_time) > $2 then 'info'
else 'ok'
end as status,
name || ' ' || engine || ' created on ' || cache_cluster_create_time || ' (' || date_part('day', now() - cache_cluster_create_time) || ' days).' as reason,
region,
account_id
from
filter_clusters;

Tags