Create and Mount an Elastic Block Data-Store

If an Amazon EC2 instance crashes, everything on it is lost. Your only resource is to launch a new instance from the last image you made of your machine. For that reason, we want to make sure that any data, logs or dynamic configuration files are located in an Elastic Block Store. This data is hosted on Amazon's S3 service, and will not be lost should your EC2 instance crash and burn.

Create a Elastic Block Storage Volume

  1. Log in to the EC2 Web Console.
  2. Go to the Elastic Block Storage window by clicking the Volumes link under Elastic Block Store on the left side of the page.
  3. Click the Create Volume Button.
  4. You will need to allocate space to the volume. Note that you will pay $0.10 per GB per month for each GB that you allocate -- even if that volume is empty. The capacity cannot be increased later, although you can relatively easily create a new, larger volume and transfer information to it.
  5. Make sure that the Availability Zone is the same as the Instance to which you'd like to link the volume.
  6. If you'd like to, specify a snapshot to use to replicate data from a backup
  7. After the Volume is created, select it from the list and click the "Attach Volume" button to link the volume to your EC2 instance. I don't know what you're supposed to pick for the attachment point... I picked /dev/sdh because that's what was used before...
Create a File System on the Volume
  1. Log in to the Instance as root and type the following command: mkfs -t ext3 /dev/sdh
    1. This creates an ext3 file system. There are other options, but I don't know the drawbacks/benefits.
Mount the Data Store
  1. Log in to the instance as root.
  2. Type the following commands:
    1. mkdir /mnt/data-store: This creates a folder to act as the mount point.
    2. mount /dev/sdh /ment/data-store: This mounts the volume to the folder you created.