How to convert instance-store to EBS for boot

In the last days I spent some time to take care of some AWS instances, and I ported one of this from instance-store to EBS, so the whole server is persistent and can be restarted without any data loosing.

  • Start ad instance-store machine, modify as you like.
  • Create a Volume with the size of 10GB and attach it to instance (suppose that it will be /dev/sdf).
  • format it as EXT3
    mkfs.ext3 /dev/sdf
  • mount it

    mkdir /mnt/ebs
    mount /dev/sdf /mnt/ebs
  • sync the instance with the volume

    rsync -avHx / /mnt/ebs
    rsync -avHx /dev /mnt/ebs
  • flush and umount

    sync
    umount /mnt/ebs
  • detach the volume and create a snapshot
  • register the AMI

    ec2-register --region $REGION -s $SNAP –name $NAME –description “$DESC” –architecture $ARCH --root-device-name /dev/sda1 --block-device-mapping '/dev/sda2=ephemeral0' --block-device-mapping '/dev/sda3=ephemeral1'

    change the appropriate parameter with your own

Now you have a fresh EBS AMI ready to boot into a new instance.

Share

Tags: , ,