MEDIUM
Source
Trivy
ID
AVD-AWS-0050

Redis cluster should have backup retention turned on

Redis clusters should have a snapshot retention time to ensure that they are backed up and can be restored if required.

Impact

Without backups of the redis cluster recovery is made difficult

Follow the appropriate remediation steps below to resolve the issue.

Configure snapshot retention for redis cluster

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
---
AWSTemplateFormatVersion: "2010-09-09"
Description: A sample template
Resources:
  GoodExample:
    Type: AWS::ElastiCache::CacheCluster
    Properties:
      AZMode: cross-az
      CacheNodeType: cache.m3.medium
      Engine: redis
      NumCacheNodes: '3'
      SnapshotRetentionLimit: 7
      PreferredAvailabilityZones:
        - us-west-2a
        - us-west-2a
        - us-west-2b

Configure snapshot retention for redis cluster

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
resource "aws_elasticache_cluster" "good_example" {
  cluster_id           = "cluster-example"
  engine               = "redis"
  node_type            = "cache.m4.large"
  num_cache_nodes      = 1
  parameter_group_name = "default.redis3.2"
  engine_version       = "3.2.10"
  port                 = 6379
  
  snapshot_retention_limit = 5
}