【问题标题】:Set Redis ElastiCache eviction policy via Terraform通过 Terraform 设置 Redis ElastiCache 驱逐策略
【发布时间】:2021-04-17 01:41:06
【问题描述】:
【问题讨论】:
标签:
amazon-web-services
redis
terraform
terraform-provider-aws
amazon-elasticache
【解决方案1】:
ElastiCache 配置是通过 aws_elasticache_parameter_group 资源完成的。然后您可以指定任何parameters that are allowed by ElastiCache。
查看您想要设置的可用参数 maxmemory-policy 但值得注意的是,默认值不是不驱逐 (noeviction),而是在所有当前版本的 Redis ElastiCache 中默认为 volatile-lru无论如何可能是你需要的。如果您想使用allkeys-lru,那么您可以执行以下操作:
resource "aws_elasticache_parameter_group" "this" {
name = "cache-params"
family = "redis5.0"
parameter {
name = "maxmemory-policy"
value = "allkeys-lru"
}
}