Chapter 61 · Amazon Elasticache
Subchapter 61.18
references/migration/rollback-procedures.mdMarkdown17 KBView on GitHub
Explicit rollback procedures for every supported migration path. Each procedure assumes the pre-cutover snapshot and the old environment are still available. The skill must reference these procedures during migration planning and present the relevant rollback plan to the user before cutover.
Migration type: In-place engine switch via modify-replication-group. The Valkey 7.2 to Redis OSS 7.1 rollback is zero-downtime and preserves the endpoint IP address. (Note: the 30-60 second failover caveat applies to forward upgrades from Redis OSS versions earlier than 5.0.6, not to this rollback path.)
Preferred rollback method: ElastiCache supports rolling back from Valkey 7.2 to Redis OSS 7.1 in-place using modify-replication-group (or modify-serverless-cache for serverless). You can perform a rollback using the same API/CLI steps as an engine upgrade, specifying Redis OSS 7.1 as the target engine version. The rollback is zero-downtime and preserves the endpoint IP address. Only Valkey 7.2 to Redis OSS 7.1 is supported, even if you originally upgraded from an earlier Redis OSS version. Any user group and user associated with the replication group must be configured with engine type REDIS for the rollback to work. If a custom parameter group is in use, a compatible Redis OSS parameter group must be provided.
Alternative rollback method: You can also restore a snapshot created from your Valkey 7.2 cache as a Redis OSS 7.1 cache by specifying Redis OSS 7.1 as the target engine version during restore. This creates a new cache from the snapshot and does not affect the Valkey cache.
Note: This section covers node-based (replication group) rollback. For serverless caches, use modify-serverless-cache with --engine redis --major-engine-version 7 for in-place rollback, or restore a serverless cache snapshot specifying Redis OSS 7.1 as the target engine.
Create a manual snapshot before starting the engine switch:
aws elasticache create-snapshot \
--replication-group-id <cluster-id> \
--snapshot-name pre-valkey-upgrade-$(date +%Y%m%d-%H%M%S) \
--region <region>Record the current engine, engine version, node type, parameter group, and security group configuration.
Confirm the snapshot status is available before proceeding with the upgrade.
Roll back the engine in-place using modify-replication-group:
aws elasticache modify-replication-group \
--replication-group-id <cluster-id> \
--engine redis \
--engine-version 7.1 \
--region <region>For serverless caches, use:
aws elasticache modify-serverless-cache \
--serverless-cache-name <cache-name> \
--engine redis \
--major-engine-version 7Wait for the rollback to complete. Monitor the replication group status until it returns to available. The endpoint IP address and all other aspects of the application will not change.
Verify data integrity and application behavior (see verification steps below).
Requirements for in-place rollback:
REDIS.--cache-parameter-group-name.Use this approach if in-place rollback is not possible (e.g., user group engine type issues).
Stop application traffic to the upgraded (Valkey) cluster if possible, or prepare to redirect traffic.
Restore the pre-upgrade snapshot to a new replication group running Redis OSS:
aws elasticache create-replication-group \
--replication-group-id <cluster-id>-rollback \
--replication-group-description "Rollback from Valkey to Redis OSS" \
--engine redis \
--engine-version 7.1 \
--cache-node-type <original-node-type> \
--snapshot-name pre-valkey-upgrade-<timestamp> \
--num-cache-clusters 2 \
--transit-encryption-enabled \
--automatic-failover-enabled \
--multi-az-enabled \
--cache-subnet-group-name <subnet-group> \
--security-group-ids <sg-id> \
--region <region>Wait for the new cluster to reach available status:
aws elasticache describe-replication-groups \
--replication-group-id <cluster-id>-rollback \
--query "ReplicationGroups[0].Status" \
--region <region>Verify data integrity on the restored cluster:
DBSIZE with the expected key count from before the upgrade.Update application connection strings (or DNS) to point to the restored cluster’s endpoint.
Validate application behavior:
Decommission the Valkey cluster after the validation period:
aws elasticache delete-replication-group \
--replication-group-id <cluster-id> \
--final-snapshot-identifier <cluster-id>-final-$(date +%Y%m%d) \
--region <region>If using in-place rollback (Option A): No data loss occurs. The rollback preserves all data on the cluster.
If using snapshot restore (Option B): Any writes that occurred between the pre-upgrade snapshot and the rollback will be lost. To minimize data loss:
REDIS.Migration type: Replication-based (online) or snapshot-based (offline) migration to an ElastiCache replication group or serverless cache.
Rollback advantage: The self-managed Redis source is still running during migration. Rollback is straightforward because the source was never modified.
Prerequisite note: Online migration requires the target ElastiCache cluster to have transit encryption (TLS) disabled. If transit encryption was enabled on the target, online migration cannot be used; use backup/restore instead. See topology-validation.md for the full prerequisites checklist.
Keep the self-managed Redis instance running throughout the migration and validation period.
Create a snapshot of the ElastiCache target before cutover:
aws elasticache create-snapshot \
--replication-group-id <target-cluster> \
--snapshot-name pre-cutover-$(date +%Y%m%d-%H%M%S) \
--region <region>Record the current application connection strings and DNS entries.
Set DNS TTL to 60 seconds or less if using DNS-based endpoint switching.
Revert application connection strings to point back to the self-managed Redis endpoint.
Deploy the reverted application across all instances/containers.
Verify connectivity to the self-managed Redis:
valkey-cli -h <self-managed-host> -p 6379 --tls PING # omit --tls if TLS is not enabled on the sourceVerify data integrity:
DBSIZE matches expectations.Handle data written only to ElastiCache during cutover:
If the application wrote exclusively to ElastiCache after cutover, those writes are not on the self-managed source.
For critical data, export those keys from ElastiCache before decommissioning:
# Export individual keys via application-level read/write, or create a snapshot for bulk recovery
aws elasticache create-snapshot \
--replication-group-id <target-cluster> \
--snapshot-name post-cutover-backup-$(date +%Y%m%d) \
--region <region>Stop the ElastiCache migration if it is still in progress: call complete-migration with the --force flag to stop replication from the source without waiting for sync to finish:
aws elasticache complete-migration \
--replication-group-id <target-cluster> \
--force \
--region <region>Alternatively, delete the target replication group to cancel entirely:
aws elasticache delete-replication-group \
--replication-group-id <target-cluster> \
Keep or delete the ElastiCache target based on whether you plan to retry the migration later.
Migration type: New serverless cache created, data migrated via dual-write or snapshot-restore, then cutover.
Rollback advantage: The original node-based cluster remains running during migration.
Keep the node-based cluster running until the validation period ends.
Create a snapshot of the node-based cluster before cutover:
aws elasticache create-snapshot \
--replication-group-id <node-based-cluster> \
--snapshot-name pre-serverless-cutover-$(date +%Y%m%d-%H%M%S) \
--region <region>Document the differences between node-based and serverless that affect the application:
<cache-name>-xxxxx.serverless.<region-code>.cache.amazonaws.com (where <region-code> is an abbreviated form, e.g., use1 for us-east-1).Revert application auth configuration:
Revert application connection strings to the node-based cluster endpoint:
# Revert from serverless endpoint
# client = valkey.Valkey(host="<cache-name>-xxxxx.serverless.use1.cache.amazonaws.com", port=6379, ssl=True, username="appuser", password=pw)
# Back to node-based endpoint
client = valkey.Valkey(host="node-based-primary-endpoint", port=6379, ssl=True, password=auth_token)Revert TLS configuration if the node-based cluster does not use TLS:
ssl=True from client configuration if the original cluster did not have transit encryption enabled.Deploy the reverted application.
Verify data on the node-based cluster:
DBSIZE matches expectations.Delete the serverless cache after validation:
aws elasticache delete-serverless-cache \
--serverless-cache-name <serverless-cache> \
--final-snapshot-name <serverless-cache>-final-$(date +%Y%m%d) \
--region <region>If you changed from AUTH token to RBAC as part of the serverless migration:
password=auth_token without a username.references/migration/auth-migration.md for the full AUTH-to-RBAC rollback procedure.Migration type: New node-based cluster created, data migrated via dual-write or snapshot-restore, then cutover.
Rollback advantage: The original serverless cache remains running during migration.
Keep the serverless cache running until the validation period ends.
Create a manual snapshot of the serverless cache before cutover using CreateServerlessCacheSnapshot:
aws elasticache create-serverless-cache-snapshot \
--serverless-cache-name <serverless-cache> \
--serverless-cache-snapshot-name pre-node-cutover-$(date +%Y%m%d-%H%M%S)Document the configuration differences for rollback:
Revert application connection strings to the serverless cache endpoint:
# Revert from node-based endpoint
# client = valkey.Valkey(host="node-based-primary-endpoint", port=6379, ssl=True, password=auth_token)
# Back to serverless endpoint
client = valkey.Valkey(host="<cache-name>-xxxxx.serverless.use1.cache.amazonaws.com", port=6379, ssl=True, username="appuser", password=rbac_password)Revert auth configuration if you switched from RBAC to AUTH token:
username parameter in client configuration.Ensure TLS is enabled in client configuration (ssl=True), since serverless requires it.
Deploy the reverted application.
Verify connectivity and data:
valkey-cli -h <serverless-endpoint> -p 6379 --tls PINGDelete the node-based cluster after the validation period:
aws elasticache delete-replication-group \
--replication-group-id <node-based-cluster> \
--final-snapshot-identifier <node-based-cluster>-final-$(date +%Y%m%d) \
--region <region>After completing any rollback, run through this checklist:
DBSIZE matches expected key countpython3 scripts/security_audit.py --replication-group <name> or --serverless <name>In rare cases, rollback may not be straightforward:
In all cases, the pre-cutover snapshot provides a recovery point. The skill must confirm a snapshot exists before allowing cutover to proceed.