17 Mar 2009

How to spend $4000 from the commandline

I have used Amazon Elastic Cloud (EC2) for my dedicated hosting needs for nearly 6 months now. They’ve just released a new “bulk-buy” service that enables you to buy 1 or 3 years’ of as many instances as you want in advance. I’ve just bought 3 years of the smallest instance at $500 plus $0.03 per hour - saving just over half of my server costs over the course of the 3 years: $500 + (24365.2530.03) = $1288.94 for 3 years, verses the current cost of $0.1 per hour which is 24365.2530.1 = $2629.80 for 3 years. Both prices are ex-vat and don’t include bandwidth costs or storage costs, obviously, though those costs are themselves VERY competitive ($0.17/GB outgoing and $0.10/GB incoming). But as you can see it is a good deal for me to bulk buy in advance.

So how do you bulk buy? Amazon’s new service is called reserved instance and you bulk buy simply by typing in a command in your terminal or dos cmd prompt (ec2-purchase-reserved-instance-offering) and hey presto you’ve just bulk bought in advance. For me that was $500, but it is possible to buy the biggest instance they have for $4000! All just by issuing a single call from the commandline. That is such a scary prospect I went into my history and deleted it so that I wouldn’t accidentally call the command again by accident. Actually there was no need to delete it from my history as in order to buy a reservation you need to ask Amazon to “offer” you one (ec2-describe-reserved-instance-offering) and then use the offering id that they specify for the instance type & region you need. Once that offering id has been used it can’t be used again - but I wasn’t about to test that their code worked…

The way it works in terms of billing is that the running instance that fits the profile you’ve bought are discounted to the new rate (or as many instances that fit the reservation profile that you’ve bought anyway). You don’t need to restart any running instances and you don’t need to relaunch them in any particular way - it is really just something that is applied at billing time. Make sure you reserve the right type of instance in the right availability zone though - get that wrong and you’ve wasted a serious amount of money!

Anyway, yes, top range instance is $4000 for 3 years per instance plus $0.24 per hour per instance - so it is possible to spend $4000, plus VAT (or your country’s tax) from the commandline in one easy line! Ouch!

comments powered by Disqus