For the last few years we’ve been using a dedicated server for all of our hosting needs, but recently we decided to choose something a little more flexible and extensible and Amazon’s EC2 seemed like a perfect fit. Amazon offers a free micro instance for a year, so off we went – building our latest project. It wasn’t until the server started getting a little use that we noticed something important – a micro instance could end up costing us a significant amount of money.
At first this doesn’t make any sense because the micro instance is by far the cheapest solution Amazon offers. The problem is how storage is handled on a micro versus other types of instances. The only available choice on micro instances is the Elastic Block Storage (EBS), which charges per 1 million I/O requests. You might think a million I/O requests is a lot, but when you have an operating system, database, and web server all reading and writing data, requests build up extremely fast.
We were charged about \$0.54 the first month and didn’t think anything of it. It wasn’t until half way through the second month when we finally sat down and did the math. If five people using the site a few times a day are able to rack up half a buck, what happens if the site begins getting similar traffic to this site – 500K per month. That’s potentially 100,000 times more I/O requests, or \$54,000. Of course we don’t expect that much traffic immediately, but even a fraction of that could be a shocking bill.
With this knowledge we have moved our site to a small instance, which includes 160GB of local storage. Local storage costs nothing to read or write to, and according to Amazon’s own documentation, is typically used for large websites. There’s definitely nothing wrong with EBS and I think it’s a great service – it’s just not the right solution for running a server that will being doing tons of I/O.
Our new project includes a lot of large images and when we run out of local storage, EBS will be used to dynamically expand our storage space. This solution makes sense, because if an image is requested a million times, it’ll only cost us 10 cents, and hopefully a million views earns us a bit more than that.
Hopefully this article doesn’t discourage anyone from using a micro instance – it was a fantastic (and free) way to build our new project. Just remember to choose the right solution for your product when the time comes to launch.