Thursday, October 02, 2008

Update on EC2 and EBS

I promised I'll give an update on my "Experiences with Amazon EC2 and EBS" post from a month ago. Well, I just got an email from Amazon, telling me:

Greetings from Amazon Web Services,

This e-mail confirms that your latest billing statement is available on the AWS web site. Your account will be charged the following:

Total: $73.74

So there you have it. That's how much it cost me to run the new SoCal Piggies wiki, as well as some other small sites, with very little traffic. Your mileage will definitely vary, especially if you run a high-traffic site.

I also said I'll give an update on running a MySQL database on EBS. It turns out it's really easy. On my Fedora Core 8 AMI, I did this:

* installed mysql packages via yum:

yum -y install mysql mysql-server mysql-devel

* moved the default data directory for mysql (/var/lib/mysql) to /ebs1/mysql (where /ebs1 is the mount point of my 10 GB EBS volume), then symlinked /ebs1/mysql back to /var/lib, so that everything continues to work as expected as far as MySQL is concerned:

service mysqld stop
mv /var/lib/mysql /ebs1/mysql
ln -s /ebs1/mysql /var/lib
service mysqld start

That's about it. I also used the handy snapshot functionality in the ElasticFox plugin and backed up the EBS volume to S3. In case you lose your existing EBS volume, you just create another volume from the snapshot, specify a size for it, and associate it with your AMI instance. Then you mount it as usual.

Update 10/03/08

In response to comments inquiring about a more precise breakdown of the monthly cost, here it is:

$0.10 per Small Instance (m1.small) instance-hour (or partial hour) x 721 hours = $72.10

$0.100 per GB Internet Data Transfer - all data transfer into Amazon EC2 x 0.607 GB = $0.06

$0.170 per GB Internet Data Transfer - first 10 TB / month data transfer out of Amazon EC2 x 2.719 GB = $0.46

$0.010 per GB Regional Data Transfer - in/out between Availability Zones or when using public IP or Elastic IP addresses x 0.002 GB = $0.01

$0.10 per GB-Month of EBS provisioned storage x 9.958 GB-Mo = $1.00

$0.10 per 1 million EBS I/O requests x 266,331 IOs = $0.03

$0.15 per GB-Month of EBS snapshot data stored x 0.104 GB-Mo = $0.02

$0.01 per 1,000 EBS PUT requests (when saving a snapshot) x 159 Requests = $0.01

EC2 TOTAL: $73.69
Other S3 costs (outside of EC2): $0.05



Anonymous said...

This was just for one month?

What sort of storage space and bandwidth did you use?

Grig Gheorghiu said...

Stephen -- yes, EC2 starts at $0.10/hour, which is $2.40/day, which is approx. $72/month. I use a 10 GB EBS volume. In terms of bandwidth, the cost was negligible, since my sites have little traffic. That's why I said that YMMV.


Randy Rizun said...

so this was for a full month (not a partial month)? in other words, s3+ebs cost was $1.74 for the full month?

Grig Gheorghiu said...

Randy -- I updated my post with the exact breakdown of my costs.


Anonymous said...

Thanks for the reply, I was curious about how amazon's pricing really worked, the 10 cents an hour sounds cheap but since a web site needs to running the full 768 hours of the month it really adds up.

So why did you choose to go that route rather than using something like a virtual private server? I would have thought that a $20/month VPS would have been more than adequate for your task and they usually are a self-managed Linux environment which is pretty much what you get with amazon? Did you just want to get some practical experience with the amazon cloud?

Grig Gheorghiu said...

Stephen -- yes, you guessed my intention exactly :-) My main goal is to gain experience with AWS, especially EC2. My next steps will be to simulate a 'real' production environment (load balancing, etc.) and automatic on-demand scaling (maybe using Enomalism's ECP platform).


Randy Rizun said...

Thanks for the cost breakdown, Grig, just an FYI my company is another solution to EC2 persistent storage.

Modifying EC2 security groups via AWS Lambda functions

One task that comes up again and again is adding, removing or updating source CIDR blocks in various security groups in an EC2 infrastructur...