To create a new EMI that is used to boot EBS-backed instances:
- Create a new volume whose size matches the size of the bootable
.img
file:
euca-create-volume -z <cluster_name> -s <size_GB>
- Attach the volume to a helper
instance:
euca-attach-volume vol-<nnnnnnnn> -i i-<nnnnnnnn> -d <device>
- Log in to the instance and copy the bootable image from its source to the helper
instance.
- While logged in to the helper instance, copy a bootable image to the attached
volume:
dd if=/<path_to_image> of=<device> bs=1M
- While logged in to the helper instance, flush the file system buffers after running the
dd command:
sync
- Detach the volume from the
instance:
euca-detach-volume vol-<nnnnnnnn>
- Create a snapshot of the bootable
volume:
euca-create-snapshot vol-<nnnnnnnn>
- Register the bootable volume as a new
EMI:
euca-register --name "<descriptive_name>" /
--snapshot snap-<nnnnnnnn>
- Run a new EBS-backed
instance:
euca-run-instances -k <key_name> emi-<nnnnnnnn>
Note: The snapshot cannot be deleted unless the EMI is first deregistered.