I write about this topic because it's one that may not be immediately obvious to those new to AWS and with previous visualization experience.
In AWS there is a much looser tie between various components that make up a server. An EC2 instance is nothing more than a reservation for some allocation of processor power and memory. Persistent block storage (EBS) or ephemeral instance storage is associated with an instance reservation and assigned a device mapping that tells the hypervisor how the volume is related to the instance. A single device either an EBS volume or ephemeral instance storage can be attached as the root (boot) device. The number of other attachable devices depends on your instance type. See the reference link below to AWS documentation for further explanation of these device mappings and these concepts.
A snapshot is related to a volume and only to an instance through the attachment of a volume. Hence a snapshot is not per say a point in time for an instance, rather it is a point in time for a volume. If you want to take a snapshot of an instance, you would in fact need to assess each attached volume and take snapshots of each as needed. If you want to snapshot the instance what you probably want to do is take a snapshot of the root drive.
Snapshots capture each block in a volume that has changed since the last snapshot was taken. Each block in a snapshot of a volume is stored as an S3 object. The more changes and time between snapshots the longer your snapshots will take as more blocks will likely need to be copied and stored as S3 objects. There is no way to revert a volume to a previous state from these snapshots. Instead, a snapshot allows you to create a new volume using the snapshotted blocks giving you a copy of a volume at a specific point in time. You'll need to then replace the attached volume on your instance with this new volume created from the snapshot.
STEPS:
- Open your AWS EC2 console https://console.aws.amazon.com/ec2 and ensure you have the proper region selected.
-
Open the Instances control panel and select the instance that you know your volume that has been snapshotted is attached to.
-
Find the volume ID
- If you scroll down in the instance details panel you'll find a section called "Block devices".
- Select the volume that you want to revert.
- Note the EBS-ID of this volume.
- Shutdown the instance if it is still running.
-
Find the volume ID
-
Open the Snapshots control panel, you should see a volume column, sort by the volume column.
- Find the snapshot(s) in this list with the volume ID you noted in the above step.
-
Right Click and select "Create Volume from Snapshot" which will open a dialog to select volume options.
-
Select the Volume Type (Standard or IOPS Provisioned)
- Note that you can only use an IOPS provisioned volume on an EBS Optimized Instance Type.
-
Enter the Size
- Note that you can expand but not shrink a volume size.
- If you chose IOPS provisioned enter the IOPS value.
-
Choose Availability Zone
- Note that you can create a volume from a snapshot in any AZ. This could be used to move datasets between AZs. Your volume will need to exist in the same AZ as the instance you want to attach it to so be sure you select the right AZ.
- Click "Yes, Create"
-
Select the Volume Type (Standard or IOPS Provisioned)
-
Open the Volume control Panel.
-
Select the volume that is still attached to your instance.
-
Find the Device Code in your volumes current attachment.
- If you scroll down in the volume details panel you'll find a section called "Attachment".
-
Note the device mapping in the displayed attachment information.
- Syntax of attachment information <Instance> (<Instance Name>):<Device Mapping> (<Status>)
- For Example in the attachment information "i-ee512299a (My Instance):/dev/sda1 (attached)" the device mapping is "/dev/sda1". This happens to be the device mapping for the root device.
- Right click and select "Detach Volume"
-
Find the Device Code in your volumes current attachment.
-
Select the new volume you created
- Note that it should show a status of Available once the volume creation has completed.
-
Right click the volume and select "Attach Volume" which will open a dialog.
- Select the instance that you want to attach to, in our example above "i-ee512299a".
- Enter the device mapping, in our case "/dev/sda1".
- Click "Yes, Attach"
-
Select the volume that is still attached to your instance.
- Startup your instance and you’re done!
Reference: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/block-device-mapping-concepts.html
NOTICE: All thoughts/statements in this article are mine alone and do not represent those of Amazon or Amazon Web services. All referenced AWS services and service names are the property of AWS. Although I have made every effort to ensure that the information in this article was correct at writing, I do not assume and hereby disclaim any liability to any party for any loss, damage, or disruption caused by errors or omissions, whether such errors or omissions result from negligence, accident, or any other cause.