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_runningSnapshot and share results via Turbot Pipes:
powerpipe loginpowerpipe control run aws_thrifty.control.elasticache_cluster_long_running --shareSteampipe Tables
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_idfrom  filter_clusters;
Params
| Args | Name | Default | Description | Variable | 
|---|---|---|---|---|
| $1 | elasticache_running_cluster_age_max_days |  | The maximum number of days clusters are allowed to run. | |
| $2 | elasticache_running_cluster_age_warning_days |  | The number of days clusters can be running before sending a warning. |