AWS: Cost optimization — an overview of Bills, Cost Explorer, and the costs control
Tags: aws, devops, todayilearned
Published: 2024-07-07 11:23:22

---
title: AWS: Cost optimization — an overview of Bills, Cost Explorer, and the costs control
published: true
date: 2024-06-28 08:35:23 UTC
tags: aws,devops,todayilearned
canonical_url: https://rtfm.co.ua/en/aws-cost-optimization-an-overview-of-bills-cost-explorer-and-the-costs-control/
---

### AWS: Cost optimization — an overview of Bills, Cost Explorer, and the costs control

![](https://cdn-images-1.medium.com/max/1024/1*JZAYCCIy6Muaxtz2FKpu0w.png)

Let’s continue our series on cost optimization in AWS.

Previous posts:

- [AWS: cost optimization — purchasing RDS Reserved Instances](https://rtfm.co.ua/en/draften-aws-optimizaciya-rasxodov-pokupka-i-analiz-rds-reserved-instances/)
- [AWS: Cost Explorer — costs checking on the CloudWatch Logs example](https://rtfm.co.ua/en/aws-cost-explorer-costs-checking-on-the-cloudwatch-logs-example/)
- [AWS: Cost optimization — services expenses overview and traffic costs in AWS](https://rtfm.co.ua/en/aws-cost-optimization-services-expenses-overview-and-traffic-costs-in-aws/)

Now that we understand what we pay for in AWS, let’s see what tools AWS provides to track and optimize these costs. All tools can be found [here>>>>](https://docs.aws.amazon.com/whitepapers/latest/cost-optimization-laying-the-foundation/reporting-cost-optimization-tools.html).

In this post, let’s take a look at two places to start your cost review — Bills and AWS Cost Explorer. In the next ones, we’ll touch on [Trusted Advisor](http://aws.amazon.com/premiumsupport/technology/trusted-advisor/), [Compute Optimizer](https://aws.amazon.com/ru/compute-optimizer/), and [S3 Analytics](https://docs.aws.amazon.com/AmazonS3/latest/userguide/analytics-storage-class.html).

**_Note_** _: The_ [_original post_](https://rtfm.co.ua/ru/aws-costs-optimization-obzor-bills-i-cost-explorer-i-kontrol-rasxodov/) _pusblished in russian in 2021, but it’s still relevant._

### AWS Bills

The Bills is useful in that firstly it provides details on each AWS Region, and secondly — a detailed count on the costs of each service.

Go to the _Billing Management Console_, select _Bills_ on the left, select the month of interest — and get a full report on discounts and charges:

![](https://cdn-images-1.medium.com/max/1024/0*yoqdk1V-hLWc5m0p.png)

On the screenshot you can see the _Compute Savings Plans_ discounts — we’ll look at them later, and the _EDP Discounts_ (AWS Enterprise Discount Program — EDP) — this is a discount from AWS for our organization, as we have many projects and AWS gives us significant discounts (for example — 90% discount on CloudFront — very tasty).

Next, for each service the Bills has a detailed calculation of exactly what was billed for, broken down by region.

For example, a bill for EC2 might look like this:

![](https://cdn-images-1.medium.com/max/1024/0*mYiidBhas7V-iUVa.png)

Now that we have a good idea of the overall cost structure, let’s see what Cost Explorer can tell us.

### AWS Cost Explorer

The Cost Explorer is probably the main tool for controlling costs.

Go to the _AWS Cost Management > Cost Explorer_, select a period of interest, in the _Group by_ choose the _Service_, and you’ll see the main costs here:

![](https://cdn-images-1.medium.com/max/1024/0*rBNuj_YptzbR9fQ0.png)

On the chart itself we see the top 5 services we spend money on, and in the table below we can see the full list.

### Cost allocation tags

A very useful thing is the [Cost Allocation Tags](https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/cost-alloc-tags.html), which allows you to categorize costs by tag in the Cost Explorer.

For example, we have `Tier` and `Env` tags. The `Tier` indicates a team to which a resource belongs (_DevOps, Backend, QA_, etc), and the `Env` indicates an environment (_Dev, Stage, Prod_).

Using them we can get statistics on the necessary groups of resources:

![](https://cdn-images-1.medium.com/max/1024/0*LYDnEUFTbtnGstf5.png)

EC2-Instances costs with a negative value are discounts on resources, in this case these are Saving Plans.

### Cost Explorer: Group by and Filters

In the Cost Explorer, we have two main tools, **Group by** and  **Filters**.

For example, to see the cost detail by the EC2-Instance Type — in the **Group by** choose the _Instance Type_, and in the **Filters** choose the _EC2-Instances_:

![](https://cdn-images-1.medium.com/max/1024/0*gzWXwYtTAtcp35pc.png)

Another useful option in the Filters is the _Usage Type Group_, which allows you to display costs by a specific category, for example, to display a NAT Gateway data processing costs by environment

Use the **Group by** _Tag: Env_ and **Filters** _Usage Type Group_: _EC2: NAT Gateway — Data Processed_:

![](https://cdn-images-1.medium.com/max/1024/0*Mc_8BULQiTA28zh0.png)

For a description of all _Usage Type Groups_ — see [Filter and Group Options](https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/ce-filtering.html#filtergrouptypes)

### AWS Resource Groups Tag editor, and the EC2 Global View

Although the [Tag Editor](https://docs.aws.amazon.com/ARG/latest/userguide/tag-editor.html) doesn’t apply to Cost Explorer, but since we are looking for the EC2 instances costs without the `Tier` tag - we need to find them.

Here, the Tag Editor will be very useful, as it allows you to find resources by specified (or vice versa — not specified tags), and immediately update by adding the necessary tags to a bunch of resources.

For example, you can find all EC2s in all regions without the `Tier` tag like this:

![](https://cdn-images-1.medium.com/max/1024/0*F9wi4ppji5V5NQJc.png)

Also, instances can be found through a recently introduced tool in the AWS Console — the EC2 Global View:

![](https://cdn-images-1.medium.com/max/1024/0*UynhKigMQ4ZRN37V.png)

### Cost Explorer — the traffic costs information

Now that we’ve touched on Data Transfer, let’s see how we can use Cost Explorer to check how much we pay for traffic, and for what exactly.

For example, to display information about how much traffic was transferred through EC2 instances — we can use such a filter:

![](https://cdn-images-1.medium.com/max/356/0*9PV1tpb5vX4BnHHg.png)

Grouped by service:

![](https://cdn-images-1.medium.com/max/1024/0*S2G-7TzHov--8OAW.png)

Or grouped by _API Operations_:

![](https://cdn-images-1.medium.com/max/1024/0*WE59hGZAYhwKUk3g.png)

Or apply in **Filters** a selection by _Usage Type_ and **Group By** : _Service_:

![](https://cdn-images-1.medium.com/max/1024/0*rdfjaDrswrM4lcJq.png)

### Reports

In the _Reports_ there is a set of pre-built reports for the Cost Explorer:

![](https://cdn-images-1.medium.com/max/1002/0*m-wG9hMqY36ISyHm.png)

And you can save your reports with **Group by** , **Filters** and a time period, so that you don’t have to customize the sampling again next time:

![](https://cdn-images-1.medium.com/max/1024/0*sgZFEFI1EAQ-fcV3.png)

### Cost Explorer: what is the “EC2-other”?

Probably the most frequently asked question on AWS Cost Explorer, including by me.

Actually — what’s included in **EC2-Other** , and why is it so expensive? On the very first chart, it costs almost 170 dollars out of 800:

![](https://cdn-images-1.medium.com/max/391/0*SDolR8l0kd59sNBa.png)

Let’s see. Select _EC2-Other_ in **Filters:** and _Usage type_ in **Group by** :

![](https://cdn-images-1.medium.com/max/1024/0*nsvpiTTkL6Omqzm2.png)

And you can see it right away:

- `USE2-EBS:VolumeUsage.gp2`: all Elastic Block Stores created and used in _us-east-2_ (_USE2_)
- `USE2-DataTransfer-Regional-Bytes`: Interzone-In and Interzone-Out traffic (cross-availability zone traffic, see [AWS: Cost optimization – services expenses overview and traffic costs in AWS](https://rtfm.co.ua/en/aws-cost-optimization-services-expenses-overview-and-traffic-costs-in-aws/))
- `USE2-NatGateway-Bytes`: NAT Gateways traffic handling
- `USE2-NatGateway-Hours`: NAT Gateways operating hours

The _Others_ include other costs, for example — Elastic IP that are not connected to any instances:

![](https://cdn-images-1.medium.com/max/676/0*PFdDlsypMgbu7U6I.png)

To summarize, the EC2-Other includes costs for:

- EBS disks: I/O operations, and provisioned storage (how much EBS space is allocated across the account), snapshots (storage, data transfer)
- CPUCredits: surcharge for burst instances T2/3/4
- NAT Gateways: number of bytes processed, operating time in hours
- Data Transfer: Transfer data between AWS Availability Zones (cross-AZ traffic)
- Elastic IP: EIPs not connected to EC2

### Useful links

- [$65,589 spent on AWS in September — A full breakdown of ConvertKit’s AWS bill](https://engineering.convertkit.com/2019/10/15/aws.html)
- [Understanding Networking Costs in AWS: Data Transfer Costs by Usage Type](https://www.nops.io/aws-data-transfer-cost-usage-type/)
- [10 things you can do today to reduce AWS costs](https://aws.amazon.com/ru/blogs/compute/10-things-you-can-do-today-to-reduce-aws-costs/)
- [Tips and Tricks for Exploring your Data in AWS Cost Explorer](https://aws.amazon.com/ru/blogs/aws-cloud-financial-management/tips-and-tricks-for-exploring-your-data-in-aws-cost-explorer-part-2/)
- [How AWS Pricing Works: AWS Pricing Overview](https://docs.aws.amazon.com/whitepapers/latest/how-aws-pricing-works/welcome.html)

_Originally published at_ [_RTFM: Linux, DevOps, and system administration_](https://rtfm.co.ua/en/aws-cost-optimization-an-overview-of-bills-cost-explorer-and-the-costs-control/)_._

* * *