Convert Instance Store AMIs to EBS Backed AMIs

  1. Launch an instance from an instance store-backed AMI.

  2. Make a note of the ramdisk ID and kernel ID, the running instance is using

  3. Create a 10GiB Amazon EBS volume in the same Availability Zone as that of the newly-launched instance e.g. /dev/sdf

  4. Attach the volume to the running instance using either the AWS Management Console or the command line interface.

  5. Make sure all services are turned off like mysqld, nginx etc.

  6. Format the volume with a file system. Newer kernels use /dev/xvdf convention.

    mkfs.ext3 /dev/xvdf
    
  7. Create a directory /mnt/ebs and mount the volume on it.

    mkdir /mnt/ebs
    mount /dev/xvdf /mnt/ebs
    
  8. Copy the data on the root storage device to the newly-attached volume.

    rsync -avx --exclude /mnt/ebs / /mnt/ebs
    
  9. Edit /mnt/ebs/etc/fstab, /mnt/ebs/boot/grub/menu.lst and /mnt/ebs/boot/grub/grub.cfg and replace uses of LABEL=cloudimg-rootfs with /dev/xvda1.

  10. Remove /dev/xvda2 and /dev/xvda3 specific instructions from /mnt/ebs/etc/fstab.

  11. Edit /mnt/ebs/etc/fstab, /mnt/ebs/boot/grub/menu.lst and replace uses of LABEL=/ with /dev/xvde1.

  12. Remove /dev/xvde2 and /dev/xvde3 specific instructions from /mnt/ebs/etc/fstab.

  13. Create the following devices within the /mnt/ebs.

    MAKEDEV console
    MAKEDEV generic
    MAKEDEV zero
    MAKEDEV null
    
  14. Detach the volume from the instance.

  15. Create a snapshot of the volume.

  16. Register the snapshot of the volume as an AMI. While registering make sure the architecture correctly configured and the Kernel ID and Ramdisk ID should match the one taken a note of in Step 2. If the Ramdisk ID information is not available form the instance then leave it to Use Default.