Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm a bit confused here. I've been trying this for days but couldn't get it to work. Hopefully someone could shed some light here.

I have 1 instance (Amazon AMI x86_64 AMI, EBS backed) running in us-east-1 region, and I wanted to migrate to ap-southeast-1 region (using S3 bucket).

Here are the steps I've taken:

 1. ec2-bundle-vol \
    -k pk-xxx.pem \
    -u xxx \
    -c cert-xxx.pem

 2. ec2-migrate-manifest \
    -m /tmp/image.manifest.xml \
    -c cert-xxx.pem \
    -k pk-xxx.pem \
    -a xxx \
    -s xxx \
    --region ap-southeast-1

 3. ec2-upload-bundle \
    -b my-sg-bucket \
    -m /tmp/image.manifest.xml \
    -a xxx \
    -s xxx \
    --location ap-southeast-1

 4. ec2-register \
    -K pk-xxx.pem \
    -C cert-xxx.pem \
    --region ap-southeast-1 \
    my-sg-bucket/image.manifest.xml \
    --name my-ami

Everything was working fine. I'm able to see the newly created AMI in AP region. But when I tried to create an instance with the AMI, I can't choose 't1.micro' as the instance type. I soon find out that the AMI is an instance-store AMI (strange it is EBS backed in the first place).

This lead me thinking what I've done wrong here to migrate an EBS backed instance to different region without changing it to instance-store AMI?

Thanks.

share|improve this question
add comment

2 Answers 2

up vote 2 down vote accepted

The problem you see is because the command 'ec2-bundle-vol' is for creating S3-backed AMIs. You have therefore, taken your EBS backed AMI - created, uploaded, and registered its contents as an S3 backed AMI, and then launched that S3 backed AMI in the new region.

Unfortunately, there is no built in way to migrate an AMI with an EBS root between regions. You need to go about it the long way.

  • Firstly, create a snapshot of the root volume you want to migrate
  • Then, start up an instance in the source and destination regions.
    • if you don't want to have different keys for the instances (since they are in different regions), you should import your own keypair first.
  • Create an EBS volume from your snapshot, and attach it to the instance in your source region.
  • Create a new (empty) EBS volume, in the destination region, and attach to the instance you started there.
  • Format the EBS volume in the destination region with the desired file system
  • Copy the data between the EBS volumes
    • rsync over SSH is likely the way to go
  • Create a snapshot of the new (destination) EBS volume
  • Register an AMI based on that snapshot
  • Terminate the instances you started, when you are done with them

You will incur costs for the instances, the data transfer, and the EBS I/O.


There is actually another option that might be better suited to your needs.

S3-backed AMIs can be downloaded and unbundled, yielding an image of the original disk - you can then write that image to your EBS volume, and should be good to go.

Essentially, you would perform the same first steps as you already have:

  • ec2-bundle-vol ...
  • ec2-migrate-manifest ...
  • ec2-upload-bundle ...

Then, in the destination region:

  • Start a new instance, and attach a sufficiently sized EBS volume
    • You will also need enough free space on the instance to store the image temporarily (the ephemeral storage on a small instance should be ample).

  • Download your bundled volume to the instance:
    ec2-download-bundle -b BUCKET_NAME -m MANIFEST.xml -d TARGET_DIRECTORY
    • You also need to either pass your ACCESS_KEY, SECRET_ACCESS_KEY, and PRIVATE_KEY, or have then set as environment variables.

  • Unbundle the volume:
ec2-unbundle  -m /local/path/to/manifest.xml -s SOURCE_DIRECTORY -d DESTINATION_DIRECTORY
  • Copy to EBS Volume:
dd if=/path/to/image of=/dev/NAME
share|improve this answer
1  
Great explanation indeed, make me understand more about migrating an EBS. Thanks a lot! I did the rsync approach before but with no success because remote host refused connection half way and log me out completely. So, your second option is the way to go for me. After hours of trying (sometime I'm slow learner, even after you already giving me advice about making enough free space for the volume, I still got it wrong). Anyhow, I got it running following the exact steps you suggested. So I can say that your solution works!!! –  Voon Feb 17 '12 at 19:08
add comment

Migrating instances across regions is indeed not as straight forward as one would like to think, albeit a solved problem:

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.