Description
An ElastiCache Redis cluster with snapshot_retention_limit set to 0 takes no automatic snapshots.
Potential impact
Without another usable backup, a failure or data corruption may leave no way to recover the earlier cache state.
Remediation
If the cache holds data you need to recover, set snapshot_retention_limit to a positive number of days. Check for a completed snapshot and regularly restore one into a new test cache.
Examples
The first configuration omits the retention setting. The revised cluster retains automatic snapshots for five days. Choose the window your service needs.
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
}