Correct process for starting new EC2 Instance from an EBS snapshot

amazon ec2snapshot

I have an EC2 instance running the Ubuntu 12.04 32bit AMI (available in the first page the Classic wizard for launching a new instance). The root device is an EBS volume. I then follow these steps:

  • Stop the server
  • Right click on volume from Volumes tab -> Create Snapshot
  • Right click on said snapshot from Snapshots tab -> Create Image from this Snapshot
  • From AMI tab, I right click on the newly created AMI and select "Launch Instance"

During the 3rd step of the wizard, I notice this line for "Storage Device Configuration"

Root    /dev/sda1   snap-xxxxxx 8GiB    standard    true

This seems to indicate to me it is using the snapshot as the root volume for the new instance (it is, in fact, the only volume).

I then launch the instance. However, it fails the "status checks" during the "initialization" step. If I right click the instance and "Get System Log", this is the tail of the log:

Using IPI No-Shortcut mode
XENBUS: Timeout connecting to devices!
md: Autodetecting RAID arrays.
md: autorun ...
md: ... autorun DONE.

EXT3-fs: sda1: couldn't mount because of unsupported optional features (240).
EXT2-fs: sda1: couldn't mount because of unsupported optional features (244).
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(8,1)

What am I doing wrong here? My concern is 2 fold:

  • If I can not boot from a snapshot, this makes the snapshot utility much less useful
  • If I can't create an AMI from a Snapshot for creating a new instance, this not only reduces the usefulness of snapshots but makes we wonder how I can "duplicate" instances easily.

Best Answer

The errors you got suggest that your file system is more recent than that supported by the kernel (most likely an ext4 on a kernel that only supports ext2/3). Some AMIs depend on a non-standard AKI (Amazon Kernel Image) to provide certain features.

In this case, the procedure you have followed seems correct, therefore, when combined with the error you received, there is a good chance that the AKIs do not match. Check the AKI used by the original instance, and compare it to that of the new instance. If they don't match, explicitly specify the AKI at launch time. (You can also manually create the AMI and in doing so, specify the AKI at that time so that it need to be specified at launch).

As an aside, a better AMI design will use PV-GRUB as a bootloader to load a kernel from the AMI itself (instead of requiring a specific external AKI), which simplifies the process of keeping the kernel up to date. The AWS documentation on user provided kernels is worth reading if you want to implement this in your AMI.