Chapter 61 · Amazon Elasticache
Subchapter 61.16
references/migration/global-datastore-operations.mdMarkdown8 KBView on GitHub
Operational guide for setting up, managing, and upgrading ElastiCache Global Datastore for cross-region replication.
Global Datastore has specific requirements that must be met before creation:
The primary replication group must already exist and be in available status.
aws elasticache create-global-replication-group \
--global-replication-group-id-suffix my-global-ds \
--primary-replication-group-id <primary-cluster-id> \
--region <primary-region>This registers the existing primary replication group as the primary member of the Global Datastore.
Wait for the Global Datastore status to become available:
aws elasticache describe-global-replication-groups \
--global-replication-group-id ldgnf-my-global-ds \
--region <primary-region>Note: The full Global Datastore ID is prefixed with a short string derived from the primary region (e.g., ldgnf- for us-east-1). Use describe-global-replication-groups without the ID filter to discover the prefix if needed.
Create a replication group in the secondary region that joins the Global Datastore:
aws elasticache create-replication-group \
--replication-group-id <secondary-cluster-id> \
--replication-group-description "Secondary region for Global Datastore" \
--global-replication-group-id ldgnf-my-global-ds \
--cache-subnet-group-name <subnet-group-in-secondary-region> \
--security-group-ids <sg-id-in-secondary-region> \
--region <secondary-region>Many parameters are inherited from the Global Datastore and must not be specified when creating a secondary, including: PrimaryClusterId, AutomaticFailoverEnabled, NumNodeGroups, CacheParameterGroupName, CacheNodeType, Engine, EngineVersion, CacheSecurityGroupNames, EnableTransitEncryption, AtRestEncryptionEnabled, SnapshotArns, and SnapshotName.
Monitor until the secondary reaches available and replication lag is minimal:
aws elasticache describe-global-replication-groups \
--global-replication-group-id ldgnf-my-global-ds \
--show-member-info \
--region <primary-region>Removing a secondary region is a two-step process: disassociate, then delete.
aws elasticache disassociate-global-replication-group \
--global-replication-group-id ldgnf-my-global-ds \
--replication-group-id <secondary-cluster-id> \
--replication-group-region <secondary-region> \
--region <primary-region>Wait for the disassociation to complete. The secondary becomes a standalone replication group in its region.
After disassociation, the secondary is independent. Delete it if no longer needed:
aws elasticache delete-replication-group \
--replication-group-id <secondary-cluster-id> \
--final-snapshot-identifier <secondary-cluster-id>-final-$(date +%Y%m%d) \
--region <secondary-region>Or retain it as a standalone cluster in that region.
To delete the Global Datastore itself, all secondaries must be disassociated first:
aws elasticache delete-global-replication-group \
--global-replication-group-id ldgnf-my-global-ds \
--retain-primary-replication-group \
--region <primary-region>Use --retain-primary-replication-group to keep the primary as a standalone cluster after disassociation. Use --no-retain-primary-replication-group to delete the primary replication group as part of the Global Datastore deletion. If you want to keep the primary, you must specify --retain-primary-replication-group explicitly.
Engine upgrades must be performed on the Global Datastore object, not on individual members. See upgrade-patching.md for the version compatibility matrix and general upgrade procedures.
aws elasticache modify-global-replication-group \
--global-replication-group-id ldgnf-my-global-ds \
--engine-version 8.0 \
--apply-immediately \
--region <primary-region>The key difference from standalone upgrades: you cannot upgrade individual member replication groups independently. The upgrade applies to secondary regions first, then to the primary region.
Use regional failover to promote a secondary to primary. This is used for disaster recovery or planned region migration.
Important: ElastiCache does not support automatic cross-region failover. When needed, you must promote a secondary cluster manually.
aws elasticache failover-global-replication-group \
--global-replication-group-id ldgnf-my-global-ds \
--primary-region <current-secondary-region> \
--primary-replication-group-id <current-secondary-cluster-id> \
--region <current-primary-region>After failover:
Monitor failover progress:
aws elasticache describe-global-replication-groups \
--global-replication-group-id ldgnf-my-global-ds \
--show-member-info \
--region <new-primary-region>The failover-global-replication-group command performs a planned failover (both regions must be healthy). For unplanned scenarios where the primary region is unavailable:
Same principle as engine upgrades: modify the Global Datastore object, not individual members. See upgrade-patching.md for general node type change procedures.
aws elasticache modify-global-replication-group \
--global-replication-group-id ldgnf-my-global-ds \
--cache-node-type cache.r7g.xlarge \
--apply-immediately \
--region <primary-region>