There is no direct way provided by Amazon to do this.. But this is certainly which can be done.. Here is how…:
Suppose you want to transfer an Amazon AMI from North America’s us-east-1 region to APAC region here is all you need to do:
NA region | Apac Region |
Create a new key pair and save it. | |
Create a new small instance of Ubuntu AMI. | |
Create a 15GiB Volume in same region | |
Attach volume to new instance. e.g., ec2-attach-volume --region ap-southeast-1 -d /dev/sdh -i <instanceid> <volumeid> | |
Login to the new instance and give proper rights to the new volume sudo chmod a+rw /dev/sdh | |
Spin an instance of AMI that you want to transfer to apac region | |
Login to this AMI and run following command to transfer data to new volume that we created in apac region.. sudo dd if=/dev/sda1 | ssh -i your-apac-key.pem public-dns-of-apac-instance dd of=/dev/sdh1 This is a binary transfer so it takes a hell lot of time.. doesn’t give any message etc.. so all you need to do is wait and get a coffee for yourself.. | |
Stop the instance and Detach both volumes from apac instance ec2-detach-volume --region ap-southeast-1 -d /dev/sdh -i <instanceid> <volumeid> | |
Attach the new volume that we created to this instance | |
Lastly Update the instance with: /etc/apt$ sudo vi sources.list :1,$s/us-east-1/ap-southeast-1/ :wq sudo apt-get update sudo apt-get upgrade and now you can create a new AMI of this Instance.. It will be exactly the same as the one in NA region. |
No comments:
Post a Comment