Custom Search

Wednesday, June 19, 2013

How to Import KVM Virtual Machine to Amazon EC2

How to Import KVM Virtual Machine to Amazon EC2

1)
Install ec2-api-tools_1.6
#wget http://launchpadlibrarian.net/111617788/ec2-api-tools_1.6.1.1-0ubuntu1_all.deb
#sudo dpkg -i ec2-api-tools_1.6.1.1-0ubuntu1_all.deb

2)
Check the Version of ec2-api-tools
#ec2-version
 3)
Export Aws Access and Secret keys
#export AWS_ACCESS_KEY=XXXXXXXXXXXXXXXXXXXXX
#export AWS_SECRET_KEY=XXXXXXXXXXXXXXXXXXXXX

4)
Create EC2 Instance using RAW Disk
#ec2-import-instance win2k-r2-disk1.xm -f RAW -t m1.small -a x86_64 -b import-export -o $AWS_ACCESS_KEY -w $AWS_SECRET_KEY --region us-west-1 -g my_sec_group

5)
Check the Progress of the task
#ec2-describe-conversion-tasks import-i-ffm2nty0 -O $AWS_ACCESS_KEY -W $AWS_SECRET_KEY --region us-west-1

6)
Resume task
#ec2-resume-import win2k-r2-disk1.xm -t import-i-ffm2nty0 -o $AWS_ACCESS_KEY -w $AWS_SECRET_KEY --region us-west-1

7)
Remove the image from S3, when the task completed
#ec2-delete-disk-image -t import-i-ffm2nty0 -o $AWS_ACCESS_KEY -w $AWS_SECRET_KEY --region us-west-1

3 comments:

  1. Got tool supporting automatic migration from KVM
    http://cloudscraper.migrate2iaas.com/ (Windows 2008 machines only)

    ReplyDelete
  2. I have KVM raw images but if i try to import them i get:

    [root@localhost vms]# /root/ec2/bin/ec2-import-instance my_server.img -f RAW -t m1.small -a x86_64 -b my_aws_bucket -o $AWS_ACCESS_KEY -w $AWS_SECRET_KEY --region us-east-1 -g my_aws_group
    Requesting volume size: 50 GB
    Client.Unsupported: Partition type Linux not allowed. ImportInstance currently supports Windows Server 2003, 2003 R2, 2008 and 2008 R2.
    [root@localhost vms]#

    any ideas?

    ReplyDelete
  3. Hi,

    I run above steps and i can see instance over ec2 but when i started to boot this i got /dev/sda1 not found and it is not working.

    virtualization : kvm
    guest vm: windows 7
    can u pls suggest to resolve this.

    ReplyDelete