Description
The ElastiCache Redis snapshot_retention_limit is the number of days to retain automatic snapshots. A value of 0 disables automatic backups. If the cache holds state that needs recovery, choose an appropriate retention period.
Potential impact
Without another valid backup, restoring an earlier state after a failure or data corruption may be difficult.
Remediation
Set snapshot_retention_limit to a positive number of days that meets your recovery requirements. Test the recovery procedure regularly.
Examples
The revised example retains automatic snapshots for five days. This is an example value; adjust it to the required recovery window.
Before
hcl
resource "aws_elasticache_cluster" "example" {
cluster_id = "cluster"
engine = "redis"
node_type = "cache.m5.large"
num_cache_nodes = 1
parameter_group_name = aws_elasticache_parameter_group.default.id
}
After
hcl
resource "aws_elasticache_cluster" "example" {
cluster_id = "cluster"
engine = "redis"
node_type = "cache.m5.large"
num_cache_nodes = 1
parameter_group_name = aws_elasticache_parameter_group.default.id
snapshot_retention_limit = 5
}