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

Exporting a Backup

Amazon ElastiCache supports exporting your ElastiCache backup to an Amazon Simple Storage Service (Amazon S3) bucket, which gives you access to it from outside ElastiCache. You can export a backup using the ElastiCache console, the AWS CLI, or the ElastiCache API.

Exporting a backup can be helpful if you need to launch a cluster in a another region. You can export your data in one region, copy the .rdb file to the new region, and then use that .rdb file to seed the new cluster instead of waiting for the new cluster to populate through use. For information about seeding a new cluster, see Seeding a New Cluster with an Externally Created Backup (Redis). Another reason you might want to export your cluster's data is to use the .rdb file for offline processing.

Important

  • The ElastiCache backup and the Amazon S3 bucket that you want to copy it to must be in the same region.

  • Backups copied to an Amazon S3 bucket are unencrypted. We strongly recommend that you do not grant others access to the Amazon S3 bucket where you want to store your backups.

Before you can export a backup to an Amazon S3 bucket you must have an Amazon S3 bucket in the same region as the backup, and then grant ElastiCache access to the bucket. The first two steps show you how to do this.

Warning: Data Vulnerability

The following scenarios expose your data in ways you may not want.

  • When another person has access to the Amazon S3 bucket you exported your backup to.

    To control access to your backups, only allow access to the Amazon S3 bucket to those who you want to access your data. For information about managing access to an Amazon S3 bucket, see Managing Access in the Amazon S3 Developer Guide.

     

  • When another person has permissions to use the CopySnapshot API.

    Users or groups that have permissions to use the CopySnapshot API can create their own Amazon S3 buckets and copy backups to it. To control access to your backups, use an IAM policy to control who has the ability to use the CopySnapshot API. For more information about using IAM to control the use of ElastiCache APIs, see Authentication and Access Control for Amazon ElastiCache in the ElastiCache User Guide.

Step 1: Create an Amazon S3 Bucket

The following procedure uses the Amazon S3 console to create an Amazon S3 bucket where you will export and store your ElastiCache backup.

To create an Amazon S3 bucket

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

  2. Choose Create Bucket.

  3. In Create a Bucket - Select a Bucket Name and Region, do the following:

    1. In Bucket Name, type a name for your Amazon S3 bucket.

      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).

    2. From the Region list, choose a region for your Amazon S3 bucket. This region must be the same region as the ElastiCache backup you want to export.

    3. Choose Create.

For more information about creating an Amazon S3 bucket, see Creating a Bucket in the Amazon Simple Storage Service Console User Guide.

Step 2: Grant ElastiCache Access to Your Amazon S3 Bucket

In order for ElastiCache to copy a snapshot to an Amazon S3 bucket, it must have acces to the bucket. The folloowing procedure grants ElastiCache access to the Amazon S3 bucket you created in the previous step.

Warning

Backups copied to an Amazon S3 bucket are unencrypted. Your data may be accessed by anyone with access to your Amazon S3 bucket. We strongly recommend that you set up IAM policies to prevent unauthorized access to this Amazon S3 bucket. For more information, see Managing Access in the Amazon S3 Developer Guide.

To grant ElastiCache access to an Amazon S3 bucket

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

  2. Choose the name of the Amazon S3 bucket that you want to copy the backup to. This should be the S3 bucket you created in Step 1: Create an Amazon S3 Bucket.

  3. Choose Permissions.

  4. Make sure that the bucket's region is the same as your ElastiCache backup's region. If it isn't, return to Step 1: Create an Amazon S3 Bucket and create a new bucket in the same region as the cluster you will backup.

  5. Choose + Add users.

  6. In the box, type the region's canonical id as shown in the following list:

    • China (Beijing) Region –

      Copy
      b14d6a125bdf69854ed8ef2e71d8a20b7c490f252229b806e514966e490b8d83

       

    • AWS GovCloud (US) Region –

      Copy
      40fa568277ad703bd160f66ae4f83fc9dfdfd06c2f1b5060ca22442ac3ef8be6

      Important

      The backup must be exported to an S3 bucket in AWS GovCloud (US).

    • All other regions –

      Copy
      540804c33a284a299d2547575ce1010f2312ef3da9b3a053c8bc45bf233e4353
  7. Set the permissions on the bucket.

    1. Choose Read and Write for Object access.

    2. Choose Read for Permissions access.

  8. Choose Save.

Your Amazon S3 bucket is now ready for you to export an ElastiCache backup to using the ElastiCache console, the AWS CLI, or the ElastiCache API.

Step 3: Export an ElastiCache Backup

Now that you've created your S3 bucket and granted ElastiCache permissions to access it, you can use the ElastiCache console, the AWS CLI, or the ElastiCache API to export your snapshot to it.

Exporting an ElastiCache Backup (Console)

The following process uses the ElastiCache console to export a backup to an Amazon S3 bucket so that you can access it from outside ElastiCache. The Amazon S3 bucket must be in the same region as the ElastiCache backup.

To export an ElastiCache backup to an Amazon S3 bucket

  1. Sign in to the AWS Management Console and open the ElastiCache console at https://console.aws.amazon.com/elasticache/.

  2. In the ElastiCache console dashboard, choose Backups.

  3. From the list of backups, choose the box to the left of the name of the backup you want to export.

  4. Choose Copy.

  5. In Create a Copy of the Backup?, do the following:

    1. In New backup name box, type a name for your new backup.

      The name must be between 1 and 1,000 characters and able to be UTF-8 encoded.

      ElastiCache adds an instance identifier and .rdb to the value that you enter here. For example, if you enter my-exported-backup, ElastiCache creates my-exported-backup-0001.rdb.

    2. From the Target S3 Location list, choose the name of the Amazon S3 bucket that you want to copy your backup to (the bucket that you created in Step 1: Create an Amazon S3 Bucket).

      The Target S3 Location must be an Amazon S3 bucket in the backup's region with the following permissions for the export process to succeed.

      • Object access – Read and Write.

      • Permissions access – Read.

      For more information, see Step 2: Grant ElastiCache Access to Your Amazon S3 Bucket.

    3. Choose Copy.

Note

If your S3 bucket does not have the permissions needed for ElastiCache to export a backup to it, you will receive one of the following error messages. Return to Step 2: Grant ElastiCache Access to Your Amazon S3 Bucket to add the permissions specified and retry exporting your backup.

  • ElastiCache has not been granted READ permissions %s on the S3 Bucket.

    Solution: Add Read permissions on the bucket.

  • ElastiCache has not been granted WRITE permissions %s on the S3 Bucket.

    Solution: Add Write permissions on the bucket.

  • ElastiCache has not been granted READ_ACP permissions %s on the S3 Bucket.

    Solution: Add Read for Permissions access on the bucket.

If you want to copy your backup to another region, use Amazon S3 to copy it. For more information, see Copying an Object in the Amazon Simple Storage Service Console User Guide.

Exporting an ElastiCache Backup (AWS CLI)

Export the backup to an Amazon S3 bucket using the copy-snapshot CLI operation with the following parameters:

Parameters

  • --source-snapshot-name – Name of the backup to be copied.

  • --target-snapshot-name – Name of the backup's copy.

    The name must be between 1 and 1,000 characters and able to be UTF-8 encoded.

    ElastiCache adds an instance identifier and .rdb to the value you enter here. For example, if you enter my-exported-backup, ElastiCache creates my-exported-backup-0001.rdb.

  • --target-bucket – Name of the Amazon S3 bucket where you want to export the backup. A copy of the backup is made in the specified bucket.

    The --target-bucket must be an Amazon S3 bucket in the backup's region with the following permissions for the export process to succeed.

    • Object access – Read and Write.

    • Permissions access – Read.

    For more information, see Step 2: Grant ElastiCache Access to Your Amazon S3 Bucket.

The following operation copies a backup to my-s3-bucket.

For Linux, macOS, or Unix:

Copy
aws elasticache copy-snapshot \ --source-snapshot-name automatic.my-redis-primary-2016-06-27-03-15 \ --target-snapshot-name my-exported-backup \ --target-bucket my-s3-bucket

For Windows:

Copy
aws elasticache copy-snapshot ^ --source-snapshot-name automatic.my-redis-primary-2016-06-27-03-15 ^ --target-snapshot-name my-exported-backup ^ --target-bucket my-s3-bucket

Note

If your S3 bucket does not have the permissions needed for ElastiCache to export a backup to it, you will receive one of the following error messages. Return to Step 2: Grant ElastiCache Access to Your Amazon S3 Bucket to add the permissions specified and retry exporting your backup.

  • ElastiCache has not been granted READ permissions %s on the S3 Bucket.

    Solution: Add Read permissions on the bucket.

  • ElastiCache has not been granted WRITE permissions %s on the S3 Bucket.

    Solution: Add Write permissions on the bucket.

  • ElastiCache has not been granted READ_ACP permissions %s on the S3 Bucket.

    Solution: Add Read for Permissions access on the bucket.

For more information, see copy-snapshot in the AWS Command Line Interface Reference.

If you want to copy your backup to another region, use Amazon S3 copy. For more information, see Copying an Object in the Amazon Simple Storage Service Console User Guide.

Exporting an ElastiCache Backup (ElastiCache API)

Export the backup to an Amazon S3 bucket using the CopySnapshot API operation with these parameters.

Parameters

  • SourceSnapshotName – Name of the backup to be copied.

  • TargetSnapshotName – Name of the backup's copy.

    The name must be between 1 and 1,000 characters and able to be UTF-8 encoded.

    ElastiCache will add an instance identifier and .rdb to the value you enter here. For example, if you enter my-exported-backup, you will get my-exported-backup-0001.rdb.

  • TargetBucket – Name of the Amazon S3 bucket where you want to export the backup. A copy of the backup is made in the specified bucket.

    The TargetBucket must be an Amazon S3 bucket in the backup's region with the following permissions for the export process to succeed.

    • Object access – Read and Write.

    • Permissions access – Read.

    For more information, see Step 2: Grant ElastiCache Access to Your Amazon S3 Bucket.

The following example makes a copy of an automatic backup to the Amazon S3 bucket my-s3-bucket.

Copy
https://elasticache.us-west-2.amazonaws.com/ ?Action=CopySnapshot &SourceSnapshotName=automatic.my-redis-primary-2016-06-27-03-15 &TargetBucket=my-s3-bucket &TargetSnapshotName=my-backup-copy &SignatureVersion=4 &SignatureMethod=HmacSHA256 &Timestamp=20141201T220302Z &Version=2016-01-01 &X-Amz-Algorithm=AWS4-HMAC-SHA256 &X-Amz-Date=20141201T220302Z &X-Amz-SignedHeaders=Host &X-Amz-Expires=20141201T220302Z &X-Amz-Credential=<credential> &X-Amz-Signature=<signature>

Note

If your S3 bucket does not have the permissions needed for ElastiCache to export a backup to it, you will receive one of the following error messages. Return to Step 2: Grant ElastiCache Access to Your Amazon S3 Bucket to add the permissions specified and retry exporting your backup.

  • ElastiCache has not been granted READ permissions %s on the S3 Bucket.

    Solution: Add Read permissions on the bucket.

  • ElastiCache has not been granted WRITE permissions %s on the S3 Bucket.

    Solution: Add Write permissions on the bucket.

  • ElastiCache has not been granted READ_ACP permissions %s on the S3 Bucket.

    Solution: Add Read for Permissions access on the bucket.

For more information, see CopySnapshot in the Amazon ElastiCache API Reference.

If you want to copy your backup to another region, use Amazon S3 copy to copy the exported backup to the Amazon S3 bucket in another region. For more information, see Copying an Object in the Amazon Simple Storage Service Console User Guide.