Create ElastiCache Redis Cluster
In this guide , We will learn how to create a ElastiCache for Redis with the Cluster mode enabled using AWS Console.
What Is ElastiCache For Redis?
Amazon ElastiCache for Redis is a managed Web service which is a caching mechanism in the Cloud.
In general , Redis runs on RAM and used as a caching and key-value pair database.
It gives us with high-performance ,Secure, Scalable caching solution.
Using ElastiCache redis cluster you can easily setup and managed in-memory data store / caching setup in the Amazon Cloud.
Features Of ElastiCache Redis
- For Redis version 3.2.4 or later , Cluster mode is enabled , By doing so , We are able to partition the data across node groups of up to 90 shards.
- Redis cluster supports Replication.
- In the Multi-AZ setup , It will automatically switch to read replica in case of failure of Primary cluster.
- It supports encryption at rest and encryption in transit with authentication.
- Automatic detection and recovery of failure nodes from the node group.
- It can be integrated with other AWS services such as Cloudwatch , Elastic Compute Cloud (EC2), SNS and Cloudtrail.
Create Redis Cluster
Lets go ahead and create a redis cluster using ElastiCache Console
In the Left Pane , Choose Redis
Click Create , For Cluster engine , Select Redis with Cluster Mode enabled

Under Redis settings ,
Specify a name for the Cluster , Provide a short description.

For Engine version compatibility , This is the redis version that will run on the redis nodes.
Lets choose the latest version (5.0.6) , And for the port You can use default 6379 or You can use custom port for security.

For Parameter group , You can use the AWS managed default parameter group or you can create a custom parameter group and use it for the cluster.
Parameter group is used to pass the values for the redis cluster which we run on the nodes.
For Node type , Choose the Instance family and type of the Instance required and click Save.

For the Number of replicas , You can specify a value between 0 to 5.
Mentioning 0 will not enable cluster with primary / replica roles.

Under Advanced Redis settings ,
Choosing Multi-AZ with Auto-failover will automatically failover to read replica in case of failure in the primary node.
We should create a private subnet group where the redis cluster will be created in the VPC.
For Subnet group , Create new ,Specify a name for the subnet group.

Then Choose the VPC ID , Under Subnets
Select One or more subnets from the VPC.The IP address to the redis nodes will be assigned from the Subnets.
In Preferred availability zones , If you choose No preference , Amazon will automatically spread the redis nodes across the Availability zones.
But It’s recommended to choose different Availability zones for Primary and Replica , For the improved tolerance.

Under Security , From the Security group , You can restrict the Network access to the redis cluster.
You can create and attach an security group with the redis cluster.
Also You can enable Encryption at rest and Encryption in-transit for added security to the data stored in the redis nodes.
If you have an existing backup of Redis , You can upload the RDB file to the S3 bucket and specifying the location of the file will import the data to the redis cluster.

Under Backup , Enabling automatic backups , Will backup the redis cluster daily.
Also You can configure the backup retention period , So that the old backups will be deleted.
You can mention the timeline for backup window Like , At what time should the backup start everyday and the duration for the same.

If you want to do any maintenance for the redis cluster such as patching or cluster modification.
And you can configure SNS Topic to notify about the maintenance activity. If you want to know more about SNS Topic and how to configure it , Read this Article.
And finally click Create.
Once the cluster is created , Click the Cluster Name , Under Description , You will get an Primary endpoint for this cluster using which you can login to redis cluster within VPC.
Conclusion
Hope this article helps you to setup a Highly-available Redis cluster on AWS.
Thanks for reading this article.Please do check out my other publications.