Creating a cluster for Valkey or Redis OSS
The following examples show how to create a Valkey or Redis OSS cluster using the AWS Management Console, AWS CLI and ElastiCache API.
ElastiCache supports replication when you use the Valkey or Redis OSS engine. To monitor the latency between
when data is written to a Valkey or Redis OSS 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 Valkey or Redis OSS cluster might be added to a
replication group at a later time, this key is included in all Valkey or Redis OSS 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 Valkey or Redis OSS (cluster mode disabled) cluster, follow the steps at Creating a Valkey (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 in ElastiCache.
If you are running Redis OSS 3.2.4 or later, you can create a Valkey or Redis OSS (cluster mode enabled) cluster. Valkey or Redis OSS (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 Valkey or Redis OSS (cluster mode disabled) and Valkey or Redis OSS (cluster mode enabled), see Supported engines and versions.
To create a Valkey or Redis OSS (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 Valkey cluster or Create Redis OSS 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 in ElastiCache.
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 in ElastiCache.
Creating a Valkey or Redis OSS (cluster mode disabled) cluster (CLI)
Example – A Valkey or Redis OSS (cluster mode disabled) Cluster with no read replicas
The following CLI code creates a Valkey or Redis OSS (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 Valkey or Redis OSS (cluster mode enabled) cluster (AWS CLI)
Valkey or Redis OSS (cluster mode enabled) clusters (API/CLI: replication groups) cannot be created using the
create-cache-cluster
operation.
To create a Valkey or Redis OSS (cluster mode enabled) cluster (API/CLI: replication group), see Creating a Valkey or Redis OSS (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 in ElastiCache.
Topics
Creating a Valkey or Redis OSS (cluster mode disabled) cache cluster (ElastiCache API)
The following code creates a Valkey or Redis OSS (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 Valkey or Redis OSS (cluster mode enabled) (ElastiCache API)
Valkey or Redis OSS (cluster mode enabled) clusters (API/CLI: replication groups) cannot be created using the
CreateCacheCluster
operation.
To create a Valkey or Redis OSS (cluster mode enabled) cluster (API/CLI: replication group), see Creating a replication group in Valkey or Redis OSS (Cluster Mode Enabled) from scratch (ElastiCache API).
For more information, see the ElastiCache API reference topic CreateReplicationGroup
.