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

Please support our work!

We have published 331 articles, 42 podcast episodes, and 15 videos. It's all free and means a lot of work in our spare time.

$6,000.00 will help us to write in-depth service reviews and comparisons in 2022! With your help, we can continue to produce independent & high-quality content focused on AWS.

$1,454.00 raised

Thanks to Alan Leech, Alex DeBrie, e9e4e5f0faef, Jaap-Jan Frans, Jens Gehring, jhoadley, Kamil Oboril, Ken Snyder, Thorsten Hoeger, Todd Valentine, and all anonymous supporters for your help! We also want to thank all supporters who purchased a cloudonaut t-shirt.

Support us
  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 launched cloudonaut.io in 2015 with my brother Andreas. Since then, we have published hundreds of articles, podcast episodes, and videos. It’s all free and means a lot of work in our spare time. We enjoy sharing our AWS knowledge with you.
Have you learned something new by reading, listening, or watching our content? If so, we kindly ask you to support us in producing high-quality & independent AWS content. We look forward to sharing our AWS knowledge with you.

Support us

Feedback? Questions? You can reach me via Email, Twitter, or LinkedIn.