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

Is it possible to create a hardware virtual machine (HVM) AMI from an existing paravirtual (PV) AMI.

My initially thought was to start a new PV instance and use the ec2-create-image command to create a new image while specifying HVM as the virutalization type. However, ec2-create-image does not have a command line parameter to specify the virtualization type.

Is there another way to go about doing this?

share|improve this question

3 Answers 3


AWS has enabled this feature in the EC2 API. It is available as the --virtualization-type option to aws ec2 register-image in the new Boto based awscli.

Original answer

Yes! Unfortunately, there is not a direct way to do so. Also, some PV instances may need kernel and bootloader modifications.

  1. Create a volume from your existing PV AMI. If it was your own PV AMI, you can make a volume from the snapshot. If it is a 3rd party AMI, you will need to launch an instance and take a snapshot.
  2. Launch an HVM instance with any AMI.
  3. Stop that HVM instance.
  4. Detach the root volume from that instance.
  5. Attach the PV volume as the root volume(/dev/sda1 or /dev/sda if it was partitioned) to the HVM instance.
  6. Run ec2-create-image on the HVM instance.
  7. Launch other instances with your new HVM AMI.

If that doesn't work, then before step 5, you will need to attach that volume to a running instance, set up a chroot, and install a kernel and bootloader for your distribution. You may also want to clear logs and any cloud-init cache.

share|improve this answer
I tried steps 1-5 and it didn't work for me, as the instance stops after a few seconds. Could someone elaborate on how to set up a chroot, and install a kernel and bootloader? Both the old and new instances are AMI Linux. Thanks. –  tolgamorf Mar 26 at 12:55
If you have a working PV instance, you can convert it to HVM by running aws ec2 register-image with the --virtualization-type flag on the snapshot of the PV image. See aws ec2 register-image help for details. –  Jeff Strunk Mar 26 at 17:07
I created an HVM image from my PV instance using aws ec2 register-image. Then I launched a new HVM instance from that image. However the system won't boot. –  tolgamorf Mar 27 at 20:27
After digging through the aws ec2 forum, I came up with a solution in which the conversion is done by replacing the files manually. I will write up an answer soon. –  tolgamorf Mar 27 at 20:29


ec2-register -a x86_64 -d '3.15.7-200.fc20.x86_64' -n 'Fedora_20_HVM_AMI'  --sriov simple --virtualization-type hvm -s snap-b44feb18 --root-device-name /dev/sda1 

Detailed steps:

Answering further based upon Jeff Strunk's response to simplify the steps and giving a bit more details on the ec2 register image:

  1. Create Instance using PV Image. Make / update any changes you want.

  2. Create Image from the above instance.

  3. Find the snapshot id used by the above AMI under EC2 > Elastic Block Store > Snapshot in EC2 Console.

    or if you have the ec2 api tools setup:

    ec2-describe-images ami-id_of_above_created_ami

    and find the snapshot id for the ami

    .. Assumptions for further steps: Your ec2 keys and api tools are set and ready to use:

  4. Register a new HVM AMI using the above snapshot: example:

ec2-register -a x86_64 -d '3.15.7-200.fc20.x86_64' -n 'Fedora_20_HVM_AMI' --sriov simple --virtualization-type hvm -s snap-b44feb18 --root-device-name /dev/sda1


  • -d is AMI description
  • -n is AMI name
  • -s is snapshot id from step 3.
  • -a is architecture
  • --virtualization-type is required for making it hvm
  • --sriov is for enabling enhanced networking , though it might be redundant, not sure.

share|improve this answer
Unless I'm doing something wrong, this will not work for marketplace AMIs that restrict instance types. Tried converting the official MongoDB paravirtual AMI to HVM, and while I could create the HVM AMI, it wouldn't launch an HVM-instance with it. –  Matt Beckman Aug 25 '14 at 17:46
@MattBeckman I think its about the underlying kernel/bootloader support rather than AMI restriction. Above works for fedora but not for amazon linux. There you have to go the way as suggested by Jeff Strunk originaly. –  Anshu Prateek Sep 1 '14 at 3:40

In my case, I had to do the conversion manually since the instance that I create using aws ec2 register-image did not boot. My solution is based on this post on the AWS EC2 Forum.


Make sure that all the volumes are in the same availability zone.

  1. SSH to your PV machine that you want to migrate from and apply all updates, then log out.

  2. Go to the AWS Console and launch a new HVM instance by selecting the same base AMI that the PV system was created from (in my case, the Amazon 64-bit Linux AMI).

  3. SSH to this new instance and apply all updates, then log out.

  4. Go to the AWS Console and stop the PV instance. Take a snapshot of the root device and create a new volume (SOURCE VOLUME) from this snapshot.

  5. Stop the HVM instance. Take a snapshot of the root device on the new instance and create a new volume (TARGET VOLUME) from this snapshot.

  6. Using the AWS Console:

    • Attach SOURCE VOLUME to the new instance as /dev/xvdf.
    • Attach TARGET VOLUME to the new instance as /dev/xvdg.

Conversion Process

  1. SSH to the new instance and get root access:

    sudo su
  2. Mount the source and target drives.

    mkdir -p /mnt/source && mount /dev/xvdf /mnt/source
    mkdir -p /mnt/target && mount /dev/xvdg1 /mnt/target

    In my case, the devices were /dev/xvdf (source) and /dev/xvdg1 (target). These may change in your configuration based on the number of partitions and where you attached them (see step 6 in Preparation). Use ls -al /dev/xvd* to see the drives.

  3. Delete everything but /boot on the target volume:

    cd /mnt/target && ls | grep -v boot | xargs rm -Rf
  4. Delete /boot on the source volume:

    rm -Rf /mnt/source/boot
  5. Copy the source volume's data to the target volume preserving all the attributes:

    rsync -aAXHPv /mnt/source/ /mnt/target
  6. Stop the system and detach all volumes using the AWS console. Attach the TARGET VOLUME on the new instance as /dev/xvda.

    Be sure to note where the original root device was mounted. In most cases, it should be /dev/xvda.

  7. Start your HVM instance. It should now be an exact duplicate of your PV system. If everything looks OK, you may now delete your PV instance and also SOURCE VOLUME.

share|improve this answer
Why don't you simply do a rm -f /boot and cp -a /mnt/source/boot /mnt/target? –  Michelem Jun 29 at 13:23

Your Answer


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.