To create a copy of an EBS Snapshot in a different AWS Region.
Table of Contents
An EBS Snapshot is a cloud resource that's AWS Region specific. (i.e. An EBS snapshot in AWS US-East can only be used to create EBS volumes in the same AWS region.) However, you may need to migrate an EBS snapshot to a different AWS region. Perhaps, you're changing your cloud architecture to a different region for cost/performance reasons. This tutorial will walk you through the process of migrating a snapshot to a different region.
In this example, you're going to migrate an EBS Snapshot from Region A to Region B. (e.g. US-East to US-West)
Remember, data transfer charges do apply!
- In AWS Region A (e.g. US-East), launch a server with an EBS volume that was created from the EBS snapshot you want to migrate.
- In AWS Region B (e.g. US-West), launch a server with a blank volume that's of the same (or larger) size as the volume that's attached to the server in Region A.
OPTIONAL: Instead of creating a blank volume on the new Region B server, consider using our EBS Toolbox or Database Manager scripts 'DB EBS Create Stripe Volume' or 'EBS Create Stripe Volume' which will create, format and mount one or more volumes for you. These volumes will then also be compatible with the remainder of our EBS/DB tools, such as backup scripts, restore scripts, automated backups, etc.
- Format the volume on the Region B server accordingly.
- Ensure you have your public and private keys setup on both Region A and Region B servers. This includes /root/.ssh/id_rsa (if running the rsync command as root) as well as the public launch key on the source (region A) server.
- Additionally, ensure that you have port 22 open to the public IPs in necessary security groups to facilitate rsync's communication. Public IPs are required because we will be migrating between cloud regions.
- SSH into the Region B server
- Run a UNIX command similar to the following on the Region B server in order to
rsync the data from the A server to the B server:
rsync -avz -i <ssh_private_key_file> root@<from_server_ip>:/mnt/ebs/ /mnt/ebs/
- Wait for all of the data to be migrated to the new volume.
- Once the data on both volumes is in-sync, take a snapshot of the volume on the Region B server. If you installed our DB or EBS tools, you can run the operational script "DB EBS Backup" or "EBS Backup" or the recipe "db::do_primary_backup" etc.