Blog |Follow Nick on Twitter| About

I can't remember if I've mentioned it here, but my weekend project at the moment is playing with Amazon Web Services, what I'm currently trying to do is supplement the very-very low (and cheap) computing resource of the server with an EC2 instance.

When you use and EC2 instance you have some data storage options; the instance comes with some on box disposable store, what I mean here is that the storage isn't persistent, when you power off the server any changes are lost. For persistent storage you can either purchase some block storage (EBS) or use the simple storage product (S3).

I'm using a centos instance that I built using this centos ami guide as such the on box storeage comes in two parts...

/dev/sda1 / ext3 defaults 1 1
/dev/sda2 /mnt ext3 defaults 1 2

The root partition is the size of the filesystem created during the AMI build and the /mnt partition is 150Gb. The root partition can be anything up-to 10Gb however you have to store your AMI on the S3 storage so the bigger you make root the more you pay, as such I've made mine as small as CentOS will allow (about 1Gb) knowing that I can use the /mnt parition once the machine is booted.

This approach comes with a headache, any application needs to be moved to /mnt to be useable... for example after installing mysql, I have to move /var/lib/mysql to /mnt/mysql else the DB fills root and everything crashes. One might say then use EBS for your root filesystem, the issue here is twofold, one with EBS you pay for what you reserve not use, you have to reserve at least 1gb and currently my DB is only 100Mb; the second is that everything else in the image is not important to me I don't care about /etc/sysconfig so why pay to store it on EBS especially since I can script any changes after boot time?

So what I'm getting at here is that EBS will make you life simpler, but you will pay for it. If most of your data is disposable then use S3, the size of root is determined by your AMI filesystem and if you fill it up stuff stops working, move everything that needs space to /mnt straight after boot (before services start) and when you're done export your work to S3.

Even though these are small numbers; if I was using EBS my project would cost 10cents to store plus costs for in/out transfers, using the disposable store and S3... even though S3 is more expense per GB to store... my current costs for store AND in out transfers is 6cents per month.... this includes storing both my AMI and my database... over time as the project grows these numbers will start to ramp up!

I'll try and post some of what I've done, it's all quite cool!


Nick Bettison ©