Anirudh Jayakumar
Anirudh Jayakumar

Reputation: 1224

AwsElastiCache Redis cluster creation: CreateCacheCluster() vs CreateReplicationGroup()

From the documentation, to create an aws elasticache redis (cluster-enabled) cluster one must use the ReplicationGroup createReplicationGroup(CreateReplicationGroupRequest request) API and not the CacheCluster createCacheCluster(CreateCacheClusterRequest request). In the createReplicationGroup there is no parameter that specifies the clusterId but there is a field for replicationGroupId.

I have the following questions w.r.t the above context.

  1. Will clusterId be same as replicationGroupId?
  2. When I query the cluster information using describeCacheClusters(DescribeCacheClustersRequest req) will the cluster created using createReplicationGroup show up?

Upvotes: 0

Views: 523

Answers (3)

Upul Doluweera
Upul Doluweera

Reputation: 2326

As per the AWS documentation

CacheCluster

The AWS::ElastiCache::CacheCluster type creates an Amazon ElastiCache cache cluster.

ReplicationGroup

The AWS::ElastiCache::ReplicationGroup resource creates an Amazon ElastiCache Redis replication group. 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.

Basically the difference is if you want to have read replicas you should go with ReplicationGroup.

Upvotes: 0

Anirudh Jayakumar
Anirudh Jayakumar

Reputation: 1224

Aws ElastiCache has essentially two kinds of clusters

  1. Non-replicated cluster - Memcahed and Redis cluster-disabled with no replicas
  2. Replicated cluster - Redis cluster-enabled and Redis cluster disabled with read replicas

To create non-replicated cluster you use createCacheCluster API and to create a replicated cluster you use createReplicationGroup API.

When a replicated cluster is created (eg. redis with 2 shard and 2 read-replicas-per-shard) a total of 6 CacheClusters are created and a replication group binds them together as a redis cluster. On the other hand if you create a Memcahced cluster with 10 nodes, only one CacheCluster is created.

So, if you query the cluster list using describeCacheClusters after creating the above mentioned configuration of Redis and Memcached you will get back 7 CacheClusters (1 - memcached and 6 - redis).

It would be better if there were more streamlined APIs to create the redis clusters without the users having to know about replication groups. Hope this helps!

Upvotes: 1

Vaisakh PS
Vaisakh PS

Reputation: 1201

If you are creating a single ElastiCache(say Redis) Cluster createCacheCluster. If you want to create a group of instances(Cluster) or Clusters you can use createReplicationGroup.

For your Other Questions. 1. Yes if the primary-cluster-id is not explicitly specified. 2. Yes if cacheClusterId is not given all the clusters are described.

Upvotes: 0

Related Questions