Volumes are basically UNIX disks ("block devices") that will persist after you terminate your instance. They are tied to a zone within a region and can only be mounted on instances within that zone.
Snapshots are an Amazon-specific thing that let you communicate data on volumes between accounts. They are "read-only" backups that are created from volumes; they can be used to create new volumes in turn, and can also be shared with specific people (or made public). Snapshots are tied to a region but not a zone.
.. thumbnail:: images/add-volume-1d.png :width: 20%
.. thumbnail:: images/add-volume-1.png :width: 20%
.. thumbnail:: images/add-volume-1b.png :width: 20%
.. thumbnail:: images/add-volume-1c.png :width: 20%
.. thumbnail:: images/add-volume-2.png :width: 20%
.. thumbnail:: images/add-volume-3.png :width: 20%
Here, your attachment point will be '/dev/sdf' and your block device will be named '/dev/xvdf'.
.. thumbnail:: images/add-volume-4.png :width: 20%
Type:
lsblk
You should see something like this:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT xvda 202:0 0 8G 0 disk `-xvda1 202:1 0 8G 0 part / xvdf 202:80 0 100G 0 disk
Now format the disk (ONLY ON EMPTY DISKS - THIS WILL ERASE ANY DATA ON THE DISK):
sudo mkfs -t ext4 /dev/xvdf
and mount the disk:
sudo mkdir /disk sudo mount /dev/xvdf /disk sudo chmod a+rwxt /disk
and voila, anything you put on /disk will be on the volume that you allocated!
The command 'df -h' will show you what disks are actually mounted & where.
Change out of the directory, stop any running programs using it, and then:
sudo umount /disk
On the 'volumes' tab in your EC2 console, go to Actions, Detach.
.. thumbnail:: images/add-volume-5.png :width: 20%
.. thumbnail:: images/add-volume-6.png :width: 20%
Note, volumes remain attached when you reboot or stop an instance, but are (of course) detached when you terminate an instance.
.. thumbnail:: images/create-snapshot-1.png :width: 20%
.. thumbnail:: images/create-snapshot-2.png :width: 20%
.. thumbnail:: images/create-snapshot-3.png :width: 20%