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:
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.
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:
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
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.