Using global datastores (CLI)
You can use the AWS Command Line Interface (AWS CLI) to control multiple AWS services from the command line and automate them through scripts. You can use the AWS CLI for ad hoc (one-time) operations.
Downloading and configuring the AWS CLI
The AWS CLI runs on Windows, macOS, or Linux. Use the following procedure to download and configure it.
To download, install, and configure the CLI
-
Download the AWS CLI on the AWS command line interface
webpage. -
Follow the instructions for Installing the AWS CLI and Configuring the AWS CLI in the AWS Command Line Interface User Guide.
Using the AWS CLI with global datastores
Use the following CLI operations to work with global datastores:
-
create-global-replication-group
aws elasticache create-global-replication-group \ --global-replication-group-id-suffixmy global datastore\ --primary-replication-group-idsample-repl-group\ --global-replication-group-descriptionan optional description of the global datastoreAmazon ElastiCache automatically applies a prefix to the global datastore ID when it is created. Each AWS Region has its own prefix. For instance, a global datastore ID created in the US West (N. California) Region begins with "virxk" along with the suffix name that you provide. The suffix, combined with the autogenerated prefix, guarantees uniqueness of the global datastore name across multiple Regions.
The following table lists each AWS Region and its global datastore ID prefix.
Region Name/Region Prefix US East (Ohio) Region
us-east-2fpkhrUS East (N. Virginia) Region
us-east-1ldgnfUS West (N. California) Region
us-west-1virxkUS West (Oregon) Region
us-west-2sgauiCanada (Central) Region
ca-central-1bxodzAsia Pacific (Mumbai) Region
ap-south-1erpgtAsia Pacific (Tokyo) Region
ap-northeast-1quwswAsia Pacific (Seoul) Region
ap-northeast-2lfqnhAsia Pacific (Osaka) Region
ap-northeast-3nlapnAsia Pacific (Singapore) Region
ap-southeast-1vlqxnAsia Pacific (Sydney) Region
ap-southeast-2vbgxdEurope (Frankfurt) Region
eu-central-1iudkwEurope (Ireland) Region
eu-west-1gxeizEurope (London) Region
eu-west-2okuqmEU (Paris) Region
eu-west-3fgjhiSouth America (São Paulo) Region
sa-east-1juxlwChina (Beijing) Region
cn-north-1emvgoChina (Ningxia) Region
cn-northwest-1ckbemAsia Pacific (Hong Kong) Region
ap-east-1knjmpAWS GovCloud (US-West)
us-gov-west-1sgwui -
create-replication-group – Use this operation to create secondary clusters for a global datastore by supplying the name of the global datastore to the
--global-replication-group-idparameter.aws elasticache create-replication-group \ --replication-group-idsecondary replication group name\ --replication-group-description“Replication group description"\ --global-replication-group-idglobal datastore nameWhen calling this operation and passing in a
--global-replication-group-idvalue, ElastiCache will infer the values from the primary replication group of the global replication group for the following paramaeters. Do not pass in values for these parameters:"PrimaryClusterId","AutomaticFailoverEnabled","NumNodeGroups","CacheParameterGroupName","CacheNodeType","Engine","EngineVersion","CacheSecurityGroupNames","EnableTransitEncryption","AtRestEncryptionEnabled","SnapshotArns","SnapshotName" -
describe-global-replication-groups
aws elasticache describe-global-replication-groups \ --global-replication-group-idmy global datastore\ --show-member-infoan optional parameter that returns a list of the primary and secondary clusters that make up the global datastore -
modify-global-replication-group
aws elasticache modify-global-replication-group \ --global-replication-group-idmy global datastore\ --automatic-failover-enabled \ --cache-node-typenode type\ --cache-parameter-group-nameparameter group name\ --engine-versionengine version\ -—apply-immediately \ --global-replication-group-descriptiondescriptionRedis to OSS Valkey cross-engine upgrade for ElastiCache GlobalDataStore
You can upgrade an existing Redis OSS global replication group to Valkey using the Console, API or CLI.
If you have an existing Redis OSS global replication group you can upgrade to Valkey by specifying the new engine and engine version with modify-global-replication-group API.
For Linux, macOS, or Unix:
aws elasticache modify-global-replication-group \ --global-replication-group-id myGlobalReplGroup \ --engine valkey \ --apply-immediately \ --engine-version 8.0For Windows:
aws elasticache modify-global-replication-group ^ --global-replication-group-id myGlobalReplGroup ^ --engine valkey ^ --apply-immediately ^ --engine-version 8.0If you have a custom cache parameter group applied to the existing Redis OSS global replication group you wish to upgrade, you will need to pass a custom Valkey cache parameter group in the request as well. The input Valkey custom parameter group must have the same Redis OSS static parameter values as the existing Redis OSS custom parameter group.
For Linux, macOS, or Unix:
aws elasticache modify-global-replication-group \ --global-replication-group-id myGlobalReplGroup \ --engine valkey \ --engine-version 8.0 \ --apply-immediately \ --cache-parameter-group-name myParamGroupFor Windows:
aws elasticache modify-global-replication-group ^ --global-replication-group-id myGlobalReplGroup ^ --engine valkey ^ --engine-version 8.0 ^ --apply-immediately ^ --cache-parameter-group-name myParamGroup -
delete-global-replication-group
aws elasticache delete-global-replication-group \ --global-replication-group-idmy global datastore\ --retain-primary-replication-groupdefaults to true -
disassociate-global-replication-group
aws elasticache disassociate-global-replication-group \ --global-replication-group-idmy global datastore\ --replication-group-idmy secondary cluster\ --replication-group-regionthe AWS Region in which the secondary cluster resides -
failover-global-replication-group
aws elasticache failover-replication-group \ --global-replication-group-idmy global datastore\ --primary-regionThe AWS Region of the primary cluster\ --primary-replication-group-idThe name of the global datastore, including the suffix. -
increase-node-groups-in-global-replication-group
aws elasticache increase-node-groups-in-global-replication-group \ --apply-immediatelyyes\ --global-replication-group-idglobal-replication-group-name\ --node-group-count3 -
decrease-node-groups-in-global-replication-group
aws elasticache decrease-node-groups-in-global-replication-group \ --apply-immediatelyyes\ --global-replication-group-idglobal-replication-group-name\ --node-group-count3 -
rebalance-shards-in-global-replication-group
aws elasticache rebalance-shards-in-global-replication-group \ --apply-immediatelyyes\ --global-replication-group-idglobal-replication-group-name
Use help to list all available commands for ElastiCache for Valkey or Redis OSS.
aws elasticache help
You can also use help to describe a specific command and learn more about its usage:
aws elasticache create-global-replication-group help