AWS’s billing is notoriously complicated, and misconfigurations in your network can lead to excess data or resource use that can pile up unnoticed. AWS provides many solutions for debugging your bill before it hits your wallet.
What Is Cost Explorer?
AWS provides a lot of services related to billing, but the most useful is the Cost Explorer. While the main billing home page provides a general overview of your bill, Cost Explorer allows you to drill down into exactly what you’re paying for.
Each penny spent in AWS is associated with a lot of data. This can help to locate unnecessary spending, which can give you some actionable insights on what you need to change in your cloud network.
For example, a common problem using too much data, as AWS has very high data costs. You could take steps to alleviate the problem, or even consider moving the problematic service to another cloud provider. Another issue might be high numbers of requests to backend services like S3—you could consider implementing more frontend caching to reduce this.
Cost Explorer is free, but you can enable “hourly granularity” if you want to pay for it. This costs a few cents per resource tracked.
Using The Cost Explorer
Cost Explorer is available from the account dropdown, under “Billing Dashboard”
On the sidebar, you’ll see the Cost Explorer. Open it up, and you’ll see a graph of your bill over time, as well as multiple ways to filter it.
At the top, you’ll see the grouping options—you’ll probably want to set this to something such as “Usage Type” or “API Operation,” which will show you what you’re actually paying for. For example, this graph is largely S3 operations, and it’s split between various costs such as data transfer out, PutObject requests, and GetObject requests.
In March here is when I switched a problematic bucket to Digital Ocean, which charges a lot less for data transfer costs. I could have also implemented more client-side caching if I wanted to stay on S3. The high DataTransfer-Out cost disappeared, leaving only the PutObject requests, which are headed for a different archival bucket that will remain on S3, though it seems reducing the rate of requests could bring the bill down even further.
If you’re using lots of different services, the filters on the side will help you narrow down the issues. You can filter costs by name, as well as by region, availability zone, instance and usage type, and even multiple accounts.
Using Tags
One of the most useful filtering options you have are tags. Tags are an AWS feature that applies across every single service. Nearly every object in AWS can be assigned key-value pairs that are used for organization.
These can be used for lots of things, but a major one is cost-tracking based on different factors. For example, perhaps you have a lot of applications running in the same cloud, using the same kkinds of resources. Giving them different tags can easily split up the costs in the Cost Explorer.
Tags are quite simple to use. They can be set programmatically when launching services with the AWS API or CloudFormation, but if you want to manually set them, you’ll usually find a settings panel for them somewhere in the settings for each service. For example, S3 has them on the bucket settings page under “Properties.”
Once set, you’ll be able to sort Cost Explorer by tag, but unless you have hourly granularity turned on, it will take a while before the next round of billing goes through.