7
votes

On terraform/cloudformation documentation there are two different resources to create an ElastiCache Redis instance:

  1. aws_elasticache_cluster (https://www.terraform.io/docs/providers/aws/r/elasticache_cluster.html)
  2. aws_elasticache_replication_group (https://www.terraform.io/docs/providers/aws/r/elasticache_replication_group.html)

What is the difference between these two? Which one should I choose?

2

2 Answers

6
votes

Simply, the replication group is for the Redis cluster and the cache cluster is for the Memcache. You cannot apply the command to the others, i.e. cache cluster for Redis cluster and vice versa.

The redis also can use aws_elasticache_cluster but only if when redis has node 1, that is not a cluster mode.

num_cache_nodes – (Required unless replication_group_id is provided) The initial number of cache nodes that the cache cluster will have. For Redis, this value must be 1. For Memcache, this value must be between 1 and 20. If this number is reduced on subsequent runs, the highest numbered nodes will be removed.

0
votes

A replication group is a collection of cache clusters, where one of the clusters is a primary read-write cluster and the others are read-only replicas.

AWS::ElastiCache::CacheCluster

AWS::ElastiCache::ReplicationGroup