Question: What is ElastiCache Replication Group?


An ElastiCache replication group is a collection of one or more cache clusters that are set up to work together as a single logical unit, providing high availability and scalability for your in-memory data store.

When you create a replication group, Amazon ElastiCache automatically provisions two or more identical cache clusters in different Availability Zones (AZs), which enables the data to be replicated across multiple nodes in different locations ensuring high availability and fault tolerance.

One of the cache clusters in the group serves as the primary node, while the others serve as replicas. The primary node accepts write requests from the client applications, while the replicas asynchronously replicate the data from the primary node. This architecture enables the read replicas to handle read requests and prevent any potential bottleneck that might occur if all the read and write operations were performed on a single node.

ElastiCache provides two types of replication groups:

  1. Multi-AZ Replication Groups: A Multi-AZ replication group spans two or more AZs within the same region to provide automatic failover capability in case of a zone-level failure.

  2. Global Datastore Replication Groups: A Global datastore replication group spans two or more AWS regions to enable low-latency reads and disaster recovery.

Here's an example of creating a replication group with two cache clusters:

aws elasticache create-replication-group \
--replication-group-id my-replication-group \
--replication-group-description "My replication group" \
--primary-cluster-id my-primary-cache-cluster \
--automatic-failover-enabled \
--cache-cluster-id-for-replication my-replica-cache-cluster-1 \
--cache-cluster-id-for-replication my-replica-cache-cluster-2 \
--engine redis \
--cache-parameter-group my-cache-parameter-group \
--security-group-ids my-security-group \
--preferred-maintenance-window sun:05:00-sun:06:00 \
--tags Key=myTag,Value=myValue

In the above example, we created a replication group with two cache clusters using Redis as our caching engine. The primary cache cluster is identified by my-primary-cache-cluster, while the replicas are identified by my-replica-cache-cluster-1 and my-replica-cache-cluster-2.

Note that it is important to choose a suitable cache engine for your use case and configure your replication group properly to ensure data consistency, availability, and performance.

Start building today

Dragonfly is fully compatible with the Redis ecosystem and requires no code changes to implement.