Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in AWS by (19.1k points)

How should I use the new AWS EC2 classes (r3, i2) with my existing AMI without recreating the whole system setup?

The new EC2 classes support only HVM based virtualization but I have only PVM AMI images.

1 Answer

0 votes
by (44.4k points)

Follow these to convert an Existing PV AMI to HVM:

  1. Create an Ubuntu HVM linux, any version, new
  2. Create an Ubuntu / with my existing AMI / PVM linux, and install grub packages on the console:                                                                                                                              apt-get install  grub-pc grub-pc-bin grub-legacy-ec2 grub-gfxpayload-lists
  3. Stop PVM linux
  4. Detach root (/dev/sda1) partition at PVM linux
  5. Attach PVM linux root partition to running HVM linux somewhere, e.g.: /dev/sdf
  6. On the HVM linux console: mkdir -p /mnt/xvdf && mount /dev/xvdf /mnt/xvdf
  7. rsync -avzXA /boot/ /mnt/xvdf/boot/
  8. mount -o bind /dev /mnt/xvdf/dev && mount -o bind /dev/pts /mnt/xvdf/dev/pts && mount -o bind /proc /mnt/xvdf/proc && mount -o bind /sys /mnt/xvdf/sys
  9. chroot /mnt/xvdf
  10. grub-install --no-floppy --recheck --force /dev/xvdf
  11. update-grub2
  12. exit chroot: CTRL+D
  13. stop HVM Linux
  14. Then, detach /dev/sda1 original root AND after that detach /dev/sdf PVM root
  15. attach PVM root to HVM linux as /dev/sda1
  16. Start HVM linux

Finally, create a new AMI image from the running HVM linux, and it will be HVM virtualized.

Related questions

0 votes
1 answer
asked Jul 8, 2019 in AWS by Amyra (12.9k points)
Want to get 50% Hike on your Salary?

Learn how we helped 50,000+ professionals like you !

0 votes
1 answer
asked Jul 10, 2019 in AWS by Amyra (12.9k points)
0 votes
1 answer
0 votes
1 answer

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...