In this post I am going to talk a little bit about EC2 scaling and pricing then follow up talking about a solution I have implemented to try to minimise the costs associated with running EC2 using as little hands on management as possible.
Amazon Web Services (AWS) has been a goto solution for many of ThinkSpatial’s projects over the last few years. We have used the Elastic Compute Cloud (EC2) platform for a wide variety of applications and areas, including everything from hosting and development to deployment and testing. If you don’t know about EC2 or AWS in general, see Amazon Web Services to learn how it can help you. Amazon provides what’s called the “Free Usage Tier” where you can try out certain services that belong to the AWS package (to a limited extent) for free. Read the Free Usage Tier page to find out more information:
AWS is scalable, so the pricing changes depending on what level of scaling you use. You have to be careful, because if you don’t know exactly what you are doing you can get caught out by this and end up with a nasty bill from Amazon at the end of the month.
EC2 instances are costed per full hour, and that cost is based on the following factors:
- Type (On-Demand, Reserved, Spot)
- Operating system
Linux/UNIX is cheaper than Windows and instances based in the USA are cheaper than instances in Sydney. A full guide by Amazon of the current instance pricing is found at the EC2 Pricing Guide and the particulars of the different factors is out of the scope of this post.
As an example of the difference in scalability throughout the EC2 range, the cheapest On-Demand instance available to users (prices in USD), is:
Operating System: Linux/UNIX
Region: US-East (N.Virginia)
Price per hour: $0.02 ($0.48 per day)
The micro instance is good for only minimal use. Micro instances typically throttle CPU time whenever CPU usage crosses a certain threshold so processing is completely out.
A mid range example based in Sydney would be:
Operating System: Windows
Region: Asia Pacific (Sydney)
Price per hour: $0.460 ($11.04 per day)
There is a huge difference in scale and pricing of these two instances. Running the larger instances is expensive, and can quickly send your AWS bill at the end of the month spiralling out of control if you don’t keep a close eye on it. The ability to stop your instances when you aren’t using them can be a big help with pricing. General administration of EC2 instances is done through the AWS dashboard and attempting to control potentially dozens or more instances through there can quickly eat up your time.
We have many instances that we use for hosted applications, many did not need to be running outside of business hours, so we decided that stopping the instances when they weren’t required would save some money. We needed to be able to automatically start and stop each instance based on a schedule that would be unique to each individual instance. AWS does not provide an easy solution for instance scheduling that we could apply to our current setup and requirements. We looked for instance scheduling solutions but were not happy with what was readily available on the market. Pre-existing solutions were either costly (some even went as far as charging you per instance stop and start), or did not meet our requirements. So we developed our own.
It uses a configuration file where users can specify instances to act upon, along with their schedules. It sends emails out to instance subscribed users whenever there is an issue scheduling an instance.
As the configuration file is independant of the application, it can be stored anywhere and modified in an unlimited number of ways. We currently have the configuration file stored inside a Dropbox directory that instance administrators have access to. This allows each person with authorization to update the configuration file on the fly from their own computer without requiring users to access the application host server directly just to make the smallest schedule changes.
The EC2 Scheduler source is currently hosted on GitHub at and is available with the Apache 2.0 license. You can read more about it, download it and see documentation on how to install and use it at GitHub.
If you discover any issues with it, please either email me or post an issue to the GitHub issue tracker.