Dragonfly Cloud is now available on the AWS Marketplace - Learn More

Question: How can one scale down an ElastiCache Redis cluster?

Answer

Scaling down an Amazon ElastiCache Redis cluster involves reducing the number of nodes or changing to a node type with less capacity. Careful considerations are needed because it may lead to data loss if not handled properly.

Here's a general process:

  1. Back up the current cluster: Always create a snapshot before making such changes. This lets you restore your cache if something goes wrong.
aws elasticache create-snapshot \ --snapshot-name my-snapshot \ --replication-group-id my-replication-group \ --cache-cluster-id my-cache-cluster
  1. Create a new cluster with a smaller size or lesser nodes: Use the snapshot to make a new, smaller cluster.
aws elasticache create-cache-cluster \ --cache-cluster-id my-new-smaller-cluster \ --cache-node-type cache.t3.micro \ # specify a smaller type here --engine redis \ --snapshot-name my-snapshot
  1. Test the new cluster: Make sure that it works as expected and can handle the load.

  2. Switch to the new cluster: Update your applications to use the new, smaller cluster.

  3. Delete the old cluster: Once everything is running smoothly with the new cluster, delete the old one.

aws elasticache delete-cache-cluster --cache-cluster-id my-old-large-cluster

This process avoids downtime during the transition. You can also use "--num-cache-nodes" option in "create-cache-cluster" command to specify fewer nodes during cluster creation.

Please note that scaling down might not be always feasible if the memory usage of your current Redis instance exceeds the memory offered by the smaller instance type. You need to ensure that the new node(s) can handle the data and connections from the existing one(s).

Was this content helpful?

White Paper

Free System Design on AWS E-Book

Download this early release of O'Reilly's latest cloud infrastructure e-book: System Design on AWS.

Free System Design on AWS E-Book

Switch & save up to 80% 

Dragonfly is fully compatible with the Redis ecosystem and requires no code changes to implement. Instantly experience up to a 25X boost in performance and 80% reduction in cost