8

What I'm trying to do is to use aws-cli to create an ElastiCache cluster based on my ElastiCache snapshots in S3, and my ElastiCache is cluster-enabled mode.

I followed this tutorial to create a cluster-enabled Redis cache and here's my command: aws elasticache create-cache-cluster --cache-cluster-id stevescachecluster1 --cache-node-type cache.m4.large --engine redis --engine-version 3.2.4 --cache-parameter-group default.redis3.2.cluster.on --num-cache-nodes 1 --snapshot-arns arn:aws:s3:::MY_S3_BUCKET-elasticache/stevesun-elasticache-0002.rdb --cache-subnet-group-name my-cache-dev

The above command fails due to An error occurred (InvalidParameterCombination) when calling the CreateCacheCluster operation: Cluster mode should be disabled in parameter group, but found it is enabled.

This is what confuses me, the above linked tutorial explicitly said that if yo want a cluster-mode enabled cache, please use .cluster.on option in your arguments.

Then I looked more into this aws-cli command reference: for this parameter: --cache-parameter-group-name, its documentation says: You cannot use any parameter group which has cluster-enabled='yes' when creating a cluster.

Isn't this contradictionary from this cli reference documentation to that cli tutorial?

Please correct me where I understand it wrong. And also, how can I create a cluster-mode enabled cache from S3 snapshots?

Thanks.

I checked and found that 3.2.4 is the latest version that AWS ElatiCache has right now.

Edit 1:

Then I just created a single-node cache using this command: aws elasticache create-cache-cluster --cache-cluster-id stevescachecluster1 --cache-node-type cache.m4.large --engine redis --engine-version 3.2.4 --cache-parameter-group default.redis3.2 --num-cache-nodes 1 --snapshot-arns arn:aws:s3:::MY_S3_BUCKET-elasticache/stevesun-elasticache-0002.rdb --cache-subnet-group-name my-cache-dev.

Then I went to the console and selected my newly launched single-node cache and clicked Modify, I tried to change it to cluster.on, but got this exception: The parameter cluster-enabled has a different value in the requested parameter group than the current parameter group. This parameter value cannot be changed for a cache cluster.

So, my attempt to launch a single-node cache first and then change it to be a cluster mode also failed.

Edit 2:

Then I thought it's that I needed to allocate more than 1 node for a cluster-enabled mode, so I changed this parameter --num-cache-nodes to 2, but I got this exception: An error occurred (InvalidParameterValue) when calling the CreateCacheCluster operation: Cannot create a Redis cluster with a NumCacheNodes parameter greater than 1. This is even more confusing to me, a cluster definitely needs more than 1 node, then why does it not allow greater than 1??

Although its documentation says For clusters running Redis, this value must be 1.. Why is this requirement? Then how can we create a new redis cluster from snapshots? Help please.

Thanks.

Fisher Coder
  • 3,278
  • 12
  • 49
  • 84

2 Answers2

3

Creating a Redis (cluster mode enabled) Cluster (AWS CLI)

Redis (cluster mode enabled) clusters (API/CLI: replication groups) cannot be created using the create-cache-cluster operation. To create a Redis (cluster mode enabled) cluster (API/CLI: replication group), see Creating a Redis (cluster mode enabled) Replication Group from Scratch (AWS CLI).

Per AWS Doc.

Looks like Replication Group from Scratch is the way to go. I'll try it now.

Efren
  • 4,003
  • 4
  • 33
  • 75
Fisher Coder
  • 3,278
  • 12
  • 49
  • 84
  • could you share your solution here? – Mike Atlas Mar 15 '18 at 18:07
  • 1
    sorry I don't recall exactly, but [Replication Group from Scratch](https://docs.aws.amazon.com/AmazonElastiCache/latest/UserGuide/Replication.CreatingReplGroup.NoExistingCluster.Cluster.html#Replication.CreatingReplGroup.NoExistingCluster.Cluster.CLI) was the way to go and helped me out. – Fisher Coder Mar 15 '18 at 23:33
  • See also [replication for cluster mode disabled from scratch](https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/Replication.CreatingReplGroup.NoExistingCluster.Classic.html#Replication.CreatingReplGroup.NoExistingCluster.Classic.CLI) – Efren Apr 22 '20 at 00:10
0

As stated in the API documentation, cache clusters with size > 1 are not supported when for redis.

Also, for redis, if you want to restore from a snapshot you have to use the --snapshot-name parameter to specify the snapshot not the --snapshot-arns parameter.

garnaat
  • 44,310
  • 7
  • 123
  • 103