6 different ways to save on AWS Costs

In this article I’m going to discuss how you can save money when using AWS. Majority of AWS costs come from EC2 and this article will focus on that. I’ve helped companies save thousands of dollars on their monthly AWS bills and I’m going to talk about what I did to achieve that.

1. Spot instances

Spot instances allow you to bid on spare computing capacity. The hourly rate is much lower than on demand instances which is a great option for certain use cases. You can use spot instances if your task doesn’t require over 6 hours to run. I use spot instances for my continuous integration build agents.

To read more about spot instances, you can visit the following link:

2. Reserved Instances

AWS offers something called reserved instances which allow you to reduce the hourly instance rate by paying an upfront fee and choosing a 1 or 3 year term. Reserved instance plans will be specific to 1 instance type. Before deciding to use reserved instances, you should make sure that it pays off first.

To read more about reserved instances, you can visit the following link:

3. New generation instances

Using new generation instances can help save money in the long term especially if you have a large amount of instances. Here is an example:

A t2.medium on demand linux instance costs $0.052/hour while an m3.medium on demand linux instance costs $0.067/hour.

There are many resources on finding EC2 instance prices, one of my personal favourites is http://www.ec2instances.info/

4. Shutting down noncritical instances at night and on the weekend

Since EC2 instances are billed hourly, shutting off noncritical instances can help save a large percentage of the instance cost. Here is an example:

If you shut down your instances at 10pm and turn them back on at 7am, you can save up to 9 hours of EC2 costs on each instance that gets shut down. You can also save up to 48 hours of EC2 instance costs if you shut instances down on the weekend.

This can easily be achieved with the use of a cron job and a script that triggers the AWS API.

Keep in mind that each time you start a stopped instance we charge a full instance hour, even if you make this transition multiple times within a single hour.[1]

This might not be realistic for distributed teams that work in different time zones.

5. Using Linux instead of Windows

A t2.medium on demand linux instance costs $0.052/hour while a t2.medium on demand windows instance costs $0.072/hour. This is obviously impossible for some teams but I wanted to mention the price difference.

6. Automating AWS cleanup

Cleaning up things like unused volumes, snapshots, and elastic ip addresses is another way to save on cost. All of these things can be done with the AWS API and a cron job.

Summary

In this article I discussed different ways in which you’re able to reduce your AWS costs. I hope you found this article useful. If you have any suggestions, feel free to leave a comment below.

[1]http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Stop_Start.html