Launching AWS Windows instance from snapshots

amazon ec2amazon-amiamazon-ebswindows-server-2008

I have a Windows-based Amazon EC2 instance with an EBS drive as the root device. Is it possible to launch a copy of this instance without creating an AMI – for instance, from a snapshot of the C: drive? We'd like to test something on a clone of the server without having to shut it down (which seems to happen if we try to create an AMI).

Best Answer

By default, when creating an AMI image of an EBS-boot instance, the instance will be shutdown. The benefit of shutting down is that the filesystem is ensured to be in a consistent state (no partial file writes).

Using the Amazon AWS Management Console, you're forced to stop the instance when creating the AMI image. However, when using the API or command-line tools, you can choose to avoid the shutdown.

ec2-create-image --no-reboot <other parameters>

If you don't want to create an image, you can duplicate your instance from a regular snapshot. To do this:

  1. Start a new instance from a standard AMI (preferably the same ami your original instance was made from)
  2. Stop the new instance
  3. Create a new volume from your snapshot
  4. Detach the boot volume from your new instance (remember the device name, for example "/dev/sda1")
  5. Attach your new volume, using the same device name
  6. Start your new instance

The new instance should resemble the original instance as long as the file system is good.

Essentially it's like duplicating a hard drive of a working PC, buying a new PC and replacing the hard drive in the new PC with your duplicate hard drive.