| Did this page help you? Yes No Tell us about it... |
If you have a snapshot of the root device volume of an instance, you can terminate that instance and then later launch a new instance from the snapshot. This is useful if you don't have the original AMI available to launch new instances from.
To launch a new instance from the snapshot, you register the snapshot and then launch the resulting AMI.
![]() | Important |
|---|---|
Registering a snapshot works only for Linux/UNIX AMIs; although you can register a snapshot to create a Windows AMI, the AMI isn't launchable. |
Use the ec2-register command and specify a block device mapping that maps
the root device name of your choice to the snapshot.
The following example specifies the root device as /dev/sda1, and maps it to the snap-12345678
snapshot. The resulting root device volume is the same size as the snapshot, and it will
automatically be deleted on instance termination. If you were to specify the block device
mapping as /dev/sda1=snap-1234578::false, then the volume would persist on instance
termination.
PROMPT> ec2-register -n My_Image_Name -d My_image_description --root-device-name /dev/sda1 -b /dev/sda1=snap-12345678 -aki-12345678The response displays the ID for your new AMI.
IMAGE ami-61a54008
The AMI now appears in the list of AMIs that you own. You can view that list in the AWS
Management Console, or by using the following command: ec2-describe-images -o
self.
Launch an instance of the AMI.
The resulting instance has a root device volume created from the snapshot.
Issue the following Query request to register an image.
The example specifies the root device as /dev/sda1, and maps it to the snap-12345678 snapshot.
The resulting root device volume is the same size as the snapshot, and it will automatically be
deleted on instance termination. You can set DeleteOnTermination to
false if you'd rather the volume persist.
https://ec2.amazonaws.com/ ?Action=RegisterImage &Name=MyImage &KernelId=aki-f70657b2 &RamdiskId=ari-ff0d5cba &RootDeviceName=/dev/sda1 &BlockDeviceMapping.1.DeviceName=/dev/sda1 &BlockDeviceMapping.1.Ebs.SnapshotId=snap-12345678 &...auth parameters...
For information about the auth parameters, go to Common Query Parameters in the Amazon Elastic Compute Cloud API Reference.
Following is an example response.
<RegisterImageResponse xmlns="http://ec2.amazonaws.com/doc/2012-04-01/"> <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId> <imageId>ami-61a54008</imageId> </RegisterImageResponse>
The AMI now appears in the list of AMIs that you own. You can view that list by using
DescribeImages with Owner=self.
Launch an instance of the AMI.
The resulting instance has a root device volume created from the snapshot.