Menu
Amazon ElastiCache
User Guide (API Version 2015-02-02)

Using a Backup to Seed a Cluster

When you create a new Redis cluster, you can seed it with data from a Redis .rdb backup file. Seeding the cluster is useful if you currently manage a Redis instance outside of ElastiCache and want to populate your new ElastiCache cluster with your existing Redis data.

When you use a Redis .rdb file to seed a new Redis cluster, you can:

  • Upgrade from a non-partitioned cluster to a Redis (cluster mode enabled) cluster running Redis version 3.2.4.

     

  • Specify a number of shards (API/CLI: node groups) in the new cluster that is different from the number of shards in the cluster that was used to create the backup file.

     

  • Specify a different node type for the new cluster—larger or smaller that used in the cluster that made the backup. If scaling to a smaller node type, be sure that the new node type has sufficient memory for your data and Redis overhead. For more information, see Ensuring You Have Sufficient Memory to Create a Redis Snapshot.

     

  • Distribute your keys in the slots of the new Redis (cluster mode enabled) cluster differently than in the cluster that was used to create the backup file.

  • You cannot seed a Redis (cluster mode disabled) cluster from an .rdb file created from a Redis (cluster mode enabled) cluster.

Important

  • You must ensure that your Redis backup data does not exceed the resources of the node. For example, you cannot upload an .rdb file with 5 GB of Redis data to a cache.m3.medium node that has 2.9 GB of memory.

    If the backup is too large, the resulting cluster will have a status of restore-failed. If this happens, you must delete the cluster and start over.

    For a complete listing of node types and specifications, see Redis Node-Type Specific Parameters and Amazon ElastiCache Product Features and Details.

  • Encrypting a Redis RDB file with S3 SSE is not supported.

The following topics walk you through migrating your non-ElastiCache for Redis cluster to Amazon ElastiCache.

Step 1: Create a Redis Backup

To create the Redis backup from which you will seed your ElastiCache for Redis instance

  1. Connect to your existing Redis instance.

  2. Run either the BGSAVE or SAVE operation to create the backup.

    BGSAVE is asynchronous and does not block other clients while processing. For more information, see BGSAVE at the Redis website.

    SAVE is synchronous and blocks other processes until finished. For more information, see SAVE at the Redis website.

For additional information on creating a backup, see Redis Persistence at the Redis website.

Step 2: Upload Your Backup to Amazon S3

Once you have created the backup file, you need to upload it to an Amazon S3 bucket. For more information on this task, see the Amazon Simple Storage Service Getting Started Guide.

It is important that you note the path to your S3 bucket for the .rdb file. For example, if my bucket name was myBucket and the path was myFolder/redis.rdb, you would enter myBucket/myFolder/redis.rdb. You need this path to seed the new cluster with the data in this backup.

The name of your Amazon S3 bucket must be DNS-compliant. Otherwise, ElastiCache cannot access your backup file. The rules for DNS compliance are:

  • Names must be at least 3 and no more than 63 characters long.

  • Names must be a series of one or more labels separated by a period (.) where each label:

    • Starts with a lowercase letter or a number.

    • Ends with a lowercase letter or a number.

    • Contains only lowercase letters, numbers, and dashes.

  • Names cannot be formatted as an IP address (e.g., 192.0.2.0).

For additional information, see Bucket Restrictions and Limitations in the Amazon Simple Storage Service Developer Guide.

We strongly recommend that you use an Amazon S3 bucket that is in the same region as your ElastiCache cluster. This approach will ensure the highest data transfer speed when ElastiCache reads your .rdb file from Amazon S3.

Step 3: Grant ElastiCache Read Access to the .rdb File

To grant ElastiCache read access to the backup file

  1. Sign in to the AWS Management Console and open the Amazon S3 console at https://console.aws.amazon.com/s3/.

  2. Choose All Buckets, and then choose the name of the S3 bucket that contains your .rdb file.

  3. Choose the name of the folder that contains your .rdb file.

  4. Choose the name of your .rdb backup file.

  5. Choose the Actions drop-down menu, and then choose Properties.

  6. In the Grantee box, type the canonical id for the region:

    • China (Beijing) Region: b14d6a125bdf69854ed8ef2e71d8a20b7c490f252229b806e514966e490b8d83

       

    • AWS GovCloud (US) Region: 40fa568277ad703bd160f66ae4f83fc9dfdfd06c2f1b5060ca22442ac3ef8be6

      Important

      The backup must be located in an S3 bucket in AWS GovCloud (US) for you to download it to a Redis cluster in AWS GovCloud (US).

    • All other regions – 540804c33a284a299d2547575ce1010f2312ef3da9b3a053c8bc45bf233e4353

  7. Choose Open/Download, and then choose Save.

Step 4: Seed the ElastiCache Cluster With the .rdb File Data

Now you are ready to create an ElastiCache cluster and seed it with the data from the .rdb file. To create the cluster, follow the directions at Creating a Cluster or Creating a Redis Cluster with Replicas from Scratch. Be sure to choose Redis as your cluster engine.

The method you use to tell ElastiCache where to find the Redis backup you uploaded to Amazon S3 depends on the method you use to create the cluster:

  • Seed the ElastiCache Cluster With the .rdb File Data Using the ElastiCache Console

    After you choose the Redis engine, expand the Advanced Redis settings section and locate Import data to cluster. In the Seed RDB file S3 location box, type in the Amazon S3 path for the files(s). If you have multiple .rdb files, type in the path for each file in a comma separated list. The Amazon S3 path will look something like myBucket/myFolder/myBackupFilename.rdb.

     

  • Seed the ElastiCache Cluster With the .rdb File Data Using the AWS CLI

    If you use the create-cache-cluster or the create-replication-group operation, use the parameter --snapshot-arns to specify a fully qualified ARN for each .rdb file. For example, arn:aws:s3:::myBucket/myFolder/myBackupFilename.rdb. The ARN must resolve to the backup files you stored in Amazon S3.

     

  • Seed the ElastiCache Cluster With the .rdb File Data Using the ElastiCache API

    If you use the CreateCacheCluster or the CreateReplicationGroup ElastiCache API operation, use the parameter SnapshotArns to specify a fully qualified ARN for each .rdb file. For example, arn:aws:s3:::myBucket/myFolder/myBackupFilename.rdb. The ARN must resolve to the backup files you stored in Amazon S3.

During the process of creating your cluster, the data in your Redis backup will be written to the cluster. You can monitor the progress by viewing the ElastiCache event messages. To do this, go to the ElastiCache console and choose Cache Events. You can also use the AWS ElastiCache command line interface or ElastiCache API to obtain event messages. For more information, see Viewing ElastiCache Events.