Introduction to EC2 Volumes
EC2 Volumes (called Elastic Block Storage by Amazon) are essentially disk images that can be mounted on any system running on EC2, and continue to exist even if the system they were attached to is deleted. They are a more permanent place to store data than the filesystem of an EC2 instance, and more easily accessible than S3.
Each volume is typically formatted with a filesystem like EXT3, and is mapped to a device like
/dev/sdb1 on the system it is connected to. It can then be mounted with the standard Linux
mount command. The size of a volume is typically several GB, and is chosen at creation time. Amazon charges for volumes based on their size and the amount of time they exist.
EC2 Volume Snapshots
An EC2 volume snapshot is a copy of a volume taken at some point in time, and stored in S3. Once a snapshot has been created, additional volumes can be created from the data in that snapshot. They can be used for backup purposes, or to duplicate or fork the contents of a volume.
Snapshots are differential backups, meaning that only the blocks on the device that have changed since your last snapshot will be incrementally saved. This means that if you have a device with 100 GBs of data, but only 5 GBs of data has changed since your last snapshot, only the 5 additional GBs of snapshot data will be stored back to Amazon S3.
Creating and Managing EC2 Volumes
To create an EC2 volume in Cloudmin, do the following :
- Login to the UI as root and go to Amazon EC2 -> EC2 Volumes.
- In the New volume details form, choose your account from the EC2 account menu.
- Enter a size in the EC2 account field, or select a snapshot to copy this volume from.
- From the Availability zone menu, select the zone that your EC2 systems have been created in. A volume can only be attached to systems in the same zone.
- Click the Create button.
Once a volume has been created, it will appear in the list on the EC2 Volumes page. To remove it, check the box next to it's ID and click the Delete Selected Volumes button. Be careful, as the data on the volume will be lost forever (unless you made a snapshot first).
Creating and Managing EC2 Snapshots
Once you have at least one EC2 volume, Cloudmin will allow you to create a snapshot of it as follows :
- Go to Amazon EC2 -> EC2 Volumes, and click on the EBS Snapshots tab.
- In the New volume snapshot details section, select the volume to copy from the Copy from volume menu.
- Click the Create button.
Once a snapshot has been created, it can be used to create new volumes as explained above. Snapshots can be deleted on the EBS Snapshots tab by checking the boxes next to their names and clicking the Delete Selected Snapshots* button.
Assigning Volumes to Systems
Once a volume has been created, it can be attached to an EC2 instance as a block device, and typically mounted a filesystem. This can be done within Cloudmin like so :
- Select your system from the left menu, and go to Resources -> Attached EC2 Volumes.
- In the Volume attachment options form, select the volume from the Volume to attach menu.
- If this is a new volume that has not been mounted anywhere yet, change the Format with filesystem to EXT3. Otherwise, leave it set to Dont format to preserve existing data.
- To have Cloudmin attempt to mount the volume, enter a path in the Mount on directory field like
- Click the Attach EC2 Volume button.
Once a volume has been attached and mounted, you can use it on your EC2 system however you wish. To detach a volume, go to the ttached EC2 Volumes page, check the box next to its ID and click the Detach Selected Volumes.