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
- Log in to the EC2 Web Console.
- Go to the Elastic Block Storage window by clicking the Volumes link under Elastic Block Store on the left side of the page.
- Click the Create Volume Button.
- 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.
- Make sure that the Availability Zone is the same as the Instance to which you'd like to link the volume.
- If you'd like to, specify a snapshot to use to replicate data from a backup
- 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
- Log in to the Instance as root and type the following command: mkfs -t ext3 /dev/sdh
- This creates an ext3 file system. There are other options, but I don't know the drawbacks/benefits.
Mount the Data Store
- Log in to the instance as root.
- Type the following commands:
- mkdir /mnt/data-store: This creates a folder to act as the mount point.
- mount /dev/sdh /ment/data-store: This mounts the volume to the folder you created.