Importing an OpenStack VM into Amazon EC2
Some quick notes for those interested:
- Install EC2 API TOOLS
- Set Access and Secret key environment variables:
- export AWS_ACCESS_KEY=xxxxxxxxxxxxxxx
- export AWS_SECRET_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
- Set up an S3 bucket and secure it to taste, to be specified later
- If exporting from OpenStack, remove the cloud-init package
- Note all prep considerations on http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/PreparingYourVirtualMachine.html
- Export the VM image - I’m using OpenStack (KVM) images in raw format, so these needed no initial conversion. You can also use VHD or VMDK
- Docs: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ImportingYourVM.html
- Command I used: ec2-import-instance ./my-awesome-image.img -f RAW -t c4.xlarge -a x86_64 -b my-awesome-bucket –region us-east-1 –availability-zone us-east-1a –subnet subnet-xxxxxx -o ${AWS_ACCESS_KEY} -w ${AWS_SECRET_KEY} -p Linux
You need to take the destination region into account - your subnet and S3 bucket be available to the region/availability zone you specify above. The import takes time after the upload is complete - watch progress with ec2-describe-conversion-tasks.