Creating a cluster
The following examples show how to create a Redis cluster using the AWS Management Console, AWS CLI and ElastiCache API.
ElastiCache supports replication when you use the Redis engine. To monitor the latency between
when data is written to a Redis read/write primary cluster and when it is propagated
to a read-only secondary cluster, ElastiCache adds to the cluster a special key,
ElastiCacheMasterReplicationTimestamp
. This key is the current
Universal Universal Time (UTC) time. Because a Redis cluster might be added to a
replication group at a later time, this key is included in all Redis clusters, even
if initially they are not members of a replication group. For more information on
replication groups, see High availability using replication groups.
To create a Redis (cluster mode disabled) cluster, follow the steps at Creating a Redis (cluster mode disabled) cluster (Console).
As soon as your cluster's status is available, you can grant Amazon EC2 access to it, connect to it, and begin using it. For more information, see Step 3: Authorize access to the cluster and Step 4: Connect to the cluster's node.
Important
As soon as your cluster becomes available, you're billed for each hour or partial hour that the cluster is active, even if you're not actively using it. To stop incurring charges for this cluster, you must delete it. See Deleting a cluster.
If you are running Redis 3.2.4 or later, you can create a Redis (cluster mode enabled) cluster. Redis (cluster mode enabled) clusters support partitioning your data across 1 to 500 shards (API/CLI: node groups) but with some limitations. For a comparison of Redis (cluster mode disabled) and Redis (cluster mode enabled), see Supported ElastiCache for Redis versions.
To create a Redis (cluster mode enabled) cluster using the ElastiCache console
-
Sign in to the AWS Management Console and open the Amazon ElastiCache console at https://console.aws.amazon.com/elasticache/
. -
From the list in the upper-right corner, choose the AWS Region that you want to launch this cluster in.
-
Choose Get started from the navigation pane.
Choose Create VPC and follow the steps outlined at Creating a Virtual Private Cloud (VPC).
On the ElastiCache dashboard page, choose Create cluster and then choose Create Redis cluster.
-
Under Cluster settings, do the following:
Choose Configure and create a new cluster.
For Cluster mode, choose Enabled.
-
For Cluster info enter a value for Name.
-
(Optional) Enter a value for Description.
Under Location:
To create the equivalent using the ElastiCache API or AWS CLI instead of the ElastiCache console, see the following:
As soon as your cluster's status is available, you can grant EC2 access to it, connect to it, and begin using it. For more information, see Step 3: Authorize access to the cluster and Step 4: Connect to the cluster's node.
Important
As soon as your cluster becomes available, you're billed for each hour or partial hour that the cluster is active, even if you're not actively using it. To stop incurring charges for this cluster, you must delete it. See Deleting a cluster.
To create a cluster using the AWS CLI, use the create-cache-cluster
command.
Important
As soon as your cluster becomes available, you're billed for each hour or partial hour that the cluster is active, even if you're not actively using it. To stop incurring charges for this cluster, you must delete it. See Deleting a cluster.
Creating a Redis (cluster mode disabled) cluster (CLI)
Example – A Redis (cluster mode disabled) Cluster with no read replicas
The following CLI code creates a Redis (cluster mode disabled) cache cluster with no replicas.
Note
When creating cluster using a node type from the r6gd family, you must pass the data-tiering-enabled
parameter.
For Linux, macOS, or Unix:
aws elasticache create-cache-cluster \ --cache-cluster-id
my-cluster
\ --cache-node-typecache.r4.large
\ --engineredis
\ --num-cache-nodes1
\ --cache-parameter-groupdefault.redis6.x
\ --snapshot-arnsarn:aws:s3:::my_bucket/snapshot.rdb
For Windows:
aws elasticache create-cache-cluster ^ --cache-cluster-id
my-cluster
^ --cache-node-typecache.r4.large
^ --engineredis
^ --num-cache-nodes1
^ --cache-parameter-groupdefault.redis6.x
^ --snapshot-arnsarn:aws:s3:::my_bucket/snapshot.rdb
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).
For more information, see the AWS CLI for ElastiCache reference topic create-replication-group
.
To create a cluster using the ElastiCache API, use the CreateCacheCluster
action.
Important
As soon as your cluster becomes available, you're billed for each hour or partial hour that the cluster is active, even if you're not using it. To stop incurring charges for this cluster, you must delete it. See Deleting a cluster.
Topics
Creating a Redis (cluster mode disabled) cache cluster (ElastiCache API)
The following code creates a Redis (cluster mode disabled) cache cluster (ElastiCache API).
Line breaks are added for ease of reading.
https://elasticache.us-west-2.amazonaws.com/ ?Action=CreateCacheCluster &CacheClusterId=my-cluster &CacheNodeType=cache.r4.large &CacheParameterGroup=default.redis3.2 &Engine=redis &EngineVersion=3.2.4 &NumCacheNodes=1 &SignatureVersion=4 &SignatureMethod=HmacSHA256 &SnapshotArns.member.1=arn%3Aaws%3As3%3A%3A%3AmyS3Bucket%2Fdump.rdb &Timestamp=20150508T220302Z &Version=2015-02-02 &X-Amz-Algorithm=&AWS;4-HMAC-SHA256 &X-Amz-Credential=<credential> &X-Amz-Date=20150508T220302Z &X-Amz-Expires=20150508T220302Z &X-Amz-SignedHeaders=Host &X-Amz-Signature=<signature>
Creating a cache cluster in Redis (cluster mode enabled) (ElastiCache API)
Redis (cluster mode enabled) clusters (API/CLI: replication groups) cannot be created using the
CreateCacheCluster
operation.
To create a Redis (cluster mode enabled) cluster (API/CLI: replication group), see Creating a replication group in Redis (Cluster Mode Enabled) from scratch (ElastiCache API).
For more information, see the ElastiCache API reference topic CreateReplicationGroup
.