Think of your EC2 instances (the virtual computer we just made) like a RAM drive. If you ever need to reset it, it reverts to it’s original structure. This means databases and changed files will go back to normal. One way to make dynamic data persist regardless of the state of your EC2 instances is to add a virtual hard drive. If you don’t need to store persistant data, skip to step four. Otherwise, click on the “Volumes and Snapshots” tab.

Click the plus icon to create a new volume. For “Availability Zone” choose the same one as the image you will attach the drive.

This can be found under the “AMIs and Instances” tab. While you’re there, right click and choose “Copy Instance ID to clipboard”.

Now, from the “Volumes and Snapshots” tab, right click on your new volume and select “Attach this volume”. Paste the instance ID (or select it from the dropdown) and give your volume a name. After clicking attach, it’s status will change to “in-use”.

SSH into your machine instance and type:

mkfs.ext3 /dev/sdh

This will format the new partition.

mkdir /ebs; mount -t ext3 /dev/sdh /ebs

to mount the volume to the path “/ebs”. You should also

vi /etc/fstab

and add this volume (as shown). You can use:

echo "/dev/sdh /ebs ext3 noatime 0 0" >> /etc/fstab

to do this (thanks to Grig for this)

This path “/ebs” (or whatever you called it) is now available to any application. It will persist even if the machine is deleted. Just bring up a new instance, and remap the drive. You can even create snapshots of the drive’s state by right clicking on the volume and selecting “Create a new snapshot from this volume”.