How-To

How To Reduce the Cost of Your Amazon EC2 Service

Forgotten resources may continue to incur costs long after they've outlived their usefulness. Here's how to keep that from happening.

Although I don't run any production workloads within the Amazon Web Services (AWS) cloud, I regularly use Amazon Elastic Compute Cloud (EC2) as a lab environment. One of the biggest lessons that I've learned in doing so is the importance of cleaning up after myself at the end of the day, and not allowing resources that I'm no longer using to linger in the AWS cloud. Those forgotten resources may continue to incur costs long after they've outlived their usefulness.

When it comes to EC2, I think that there's a perception that virtual machines (VMs) are responsible for the bulk of the costs. While VM instances can indeed account for almost all of an organization's Amazon EC2-related costs, the opposite can also be true. To show you what I mean, check out Figure 1.

[Click on image for larger view.] Figure 1. This is an Amazon EC2 billing summary for my AWS account.

Figure 1 shows a summary of my Amazon EC2-related costs over the last six months. The main thing that I wanted to point out is that my cumulative total cost for running VM instances was only $0.45 over a six-month period, which is truly a bargain. You'll also notice, however, that I incurred $95.59 in costs for what Amazon calls EC2-Other. This, of course, raises the question of where these other costs are coming into play.

AWS provides a wealth of tools for analyzing your costs. In fact, I once wrote an entire article about these tools. I highly recommend taking some time to look at the available billing tools. The information that they reveal can sometimes be surprising.

At the same time, the tools might not always be quite as granular as you might like. For example, you saw in Figure 1 that the bulk of my costs were listed as EC2-Other. That isn't very helpful if your goal is to figure out what those "other" costs are. That being the case, I wanted to take the opportunity to point out a few things within Amazon EC2 that can sometimes lead to unexpected costs.

EBS Volumes
One of the first things that I recommend checking is to see if you have any unused EBS volumes. Amazon charges $0.10 per gigabyte of provisioned general-purpose SSD, EBS storage. So with that in mind, imagine that you have a modestly sized Amazon EC2 instance with 100GB of provisioned storage. Now, suppose that you delete the instance, but forget to remove the corresponding EBS volume. That volume will cost $10 per month until you remember to delete it. Keep in mind that AWS uses different pricing for different classes of EBS storage (see pricing here). I'm just using general-purpose SSD storage as an example.

Elastic IP Addresses
Another way in which unexpected charges are sometimes incurred is because of elastic IP address use. AWS doesn't charge for elastic IP addresses -- if you're using them. In order to avoid IP address-related charges, however, an IP address has to be associated with an instance, and that instance has to be running. Furthermore, the instance can only have one IP address associated with it, and the IP address has to come from a BYOIP pool. Otherwise, AWS charges a penny per hour for the IP address.

Snapshots
Snapshots are a handy mechanism for backing up your Amazon EC2 instances, but there's a cost to storing your snapshots. It's a little bit tricky to estimate the cost of creating snapshots for your VM instances, because snapshots leverage changed block tracking. Suppose for example, that you have a 200GB VM instance, and you create a snapshot. Now, suppose that you create a few new files, and you make some changes within the VMs. If the new and modified data amounted to 10GB, then that would be the size of your snapshot. The snapshot's size is equal to the amount of data that's been written since the snapshot was created. In other words, you're being billed for the changed blocks.

Snapshots are billed on a per-gigabyte per-month basis, based on the pricing of the EBS volume that you're using.

Wrapping Up
AWS charges its subscribers for using most of the Amazon EC2 components. As such, the components mentioned within this article shouldn't be treated as a comprehensive list. The components that I mentioned are just some of the easier-to-overlook items that can result in unexpected charges on your bill.

About the Author

Brien Posey is a 22-time Microsoft MVP with decades of IT experience. As a freelance writer, Posey has written thousands of articles and contributed to several dozen books on a wide variety of IT topics. Prior to going freelance, Posey was a CIO for a national chain of hospitals and health care facilities. He has also served as a network administrator for some of the country's largest insurance companies and for the Department of Defense at Fort Knox. In addition to his continued work in IT, Posey has spent the last several years actively training as a commercial scientist-astronaut candidate in preparation to fly on a mission to study polar mesospheric clouds from space. You can follow his spaceflight training on his Web site.

Featured

Subscribe on YouTube