Calculate AWS Costs in Detail

Michael Wittig – 19 May 2021

Calculating AWS costs upfront is a challenge. To get accurate numbers, you have to understand the pricing model of the used AWS services. A pricing model consists of one or many pricing dimensions. E.g., GBs stored, number of requests, etc. Keep in mind that each service is different. EC2 instances are billed based on how long they run, how much storage you provision, and how much traffic they receive and send (some traffic is free). The pricing dimensions of an S3 bucket are stored data, number of requests, number of tags, and many more. After you understand the pricing model, you have to come up with the numbers. How much traffic does your application process? How many requests to S3 do you plan to make? The second step is usually the more challenging part. In this blog post, I share the tools and techniques I use to calculate AWS costs.

Calculate AWS Costs in Detail

The ins and outs of the architecture

To calculate costs, you need a detailed understanding of the architecture. What AWS services are used? How are the services used? What communication paths exist? What data is processed and stored? What are data retention policies? And many more questions.

I usually start by looking at the architecture diagram. I recommend diving as deep as possible to understand what’s going on. VPC Flow Logs can be helpful to understand communication paths. IAM policies provide a hint of what APIs are called.

Once you know what AWS services are used, you can familiarize yourself with the pricing models of each service.

Understanding the pricing models

Each AWS service has a pricing page. I recommend you to read them from top to bottom. There are no shortcuts if you need an accurate cost calculation. Check out the following pricing pages to get a sense of the differences between services:

Keep in mind that prices are likely different in each AWS region!

Estimating price dimension usage

Once you understand the pricing dimensions, you have to estimate the usage for each of the dimensions. Some dimensions are straightforward to guess. Others are more tricky. Let me provide you two examples.

A CloudWath dashboard is priced at $3 / month. I know that I create one dashboard, so it is easy to estimate the costs.

CloudWatch Logs are priced based on the data volume you ingest and the data volume you store. The problem: How much log data does your application produce? The log volume likely correlates with the number of requests the application processes. I recommend running an experiment to get a better understanding of the usage pattern:

Andreas and Michael Wittig

Hej, Andreas & Michael here!

We launched the cloudonaut blog in 2015. Since then, we have published 325 articles: small tips and tricks, best practices, and service reviews. We enjoy writing about all things AWS a lot.

Do you like our blog posts and podcast episodes? Have you learned something new? Consider supporting us create in-depth and independent AWS content. Please help us with a monthly or one-time payment through GitHub Sponsors.

Start supporting us today!
  1. Set up your application.
  2. Take a note of the storedBytes value of the log group.
  3. Run x number of requests through the system. If you are lucky, you can reuse a load test that you already have. Make sure that x is large enough (e.g., 100,000 requests).
  4. Take a note of the storedBytes value again.
  5. Calculate the difference between the two storedBytes values and divide them by x.

Tools

AWS provides tools to help us with cost calculations. the Pricing Calculator is the new kid on the block. The Simple Monthly Calculator is the older version you might need to fall back to. Both tools miss services and pricing dimensions! I highly recommend not skipping the Understanding the pricing models step to avoid surprises.

I use the AWS tools to come up with rough estimates only. If I need detailed calculations, I create a spreadsheet. I believe you need a spreadsheet anyway because you usually need to calculate the pricing dimension usage to enter into the tools.

I prefer to use a “business” metric as a starting point, such as daily active users or the number of files uploaded. Based on this number, I can calculate the pricing dimension usage. The screenshot shows a real-world calculation of mine:

AWS calculation spreadsheet

Pitfall: Traffic

I see many calculations miss an important aspect: traffic. Traffic costs are very tricky:

  • Traffic from the Internet to EC2 is free.
  • Traffic from EC2 to the Internet is billed.
  • Traffic between EC2 instances in the same AZ is free.
  • Traffic between EC2 instances in different AZs/regions is billed.
  • Traffic between EC2 and RDS is free.
  • Traffic between EC2 and MSK (Kafka) is billed.

I usually think about traffic costs this way: I assume all traffic is billed. I check the pricing pages to find the traffic costs. In some cases, you will find that traffic is free.

In the following video, I share my workflow in more details based on a real-world example:

Summary

Calculating AWS costs is tricky. I recommend following these steps:

  1. Understand the architecture
  2. Research pricing models of used AWS services
  3. Estimate price dimension usage

Creating an accurate calculation for a medium complex architecture can take a working day.

Michael Wittig

Michael Wittig

I'm an independent consultant, technical writer, and programming founder. All these activities have to do with AWS. I'm writing this blog and all other projects together with my brother Andreas.

In 2009, we joined the same company as software developers. Three years later, we were looking for a way to deploy our software—an online banking platform—in an agile way. We got excited about the possibilities in the cloud and the DevOps movement. It’s no wonder we ended up migrating the whole infrastructure of Tullius Walden Bank to AWS. This was a first in the finance industry, at least in Germany! Since 2015, we have accelerated the cloud journeys of startups, mid-sized companies, and enterprises. We have penned books like Amazon Web Services in Action and Rapid Docker on AWS, we regularly update our blog, and we are contributing to the Open Source community. Besides running a 2-headed consultancy, we are entrepreneurs building Software-as-a-Service products.

We are available for projects.

Feedback? Questions? Drop me a line: Email, Twitter, LinkedIn.

Briefcase icon
Hire me