Much like the ingredients in cooking, there are endless items that go into an AWS bill. Finding these resources, services, charge types, regions, tags, platforms, and so on can feel like just about the worst use of time in an engineer’s day. To make matters worse, there are some operations in Cost Explorer that require additional permissions and actually generate bills themselves.
The 9 recipes below will help you get by with Cost Explorer and explain what’s possible and what cannot be done. For an easier time, consider the cloud costs features available for free from Vantage.
- Cost per Instance ID
- EC2-Other Category
- AWS Credits
- Cost by Tagged Resources
- Group by a Tag or Multiple Tags
- Number of Hours per Instance
- Forecasting and Reserved Instances
- Savings Plans
- How to Set Permissions for Cost Explorer
Cost Per Instance ID
Filter by instance ID in Cost Explorer
It’s helpful to see specific instances that are generating costs, particularly if those instances are not operational all the time or are used in burstable scenarios like build farms. Cost Explorer provides data per Instance ID for the past 7 days. In Filters on the right, select the Resource dropdown. But note:
- This option will not be enabled by default, you must enable it in Preferences as shown below.
- Data is only available for EC2 instances, so RDS instances, ElastiCache and everything else are not available.
Enabling the setting to see resource level data in AWS
As shown in this image, you must enable Hourly and Resource Level Data in Cost Explorer Preferences shown in orange in the image. Read the note carefully so you understand that there is an extra fee for this data. Hourly and resource level reports cost $7.30 per month per EC2 instance.
Two selections are needed to break out the EC2-Other category in Cost Explorer
You can think of EC2-Other as the miscellaneous line item that encompasses cost categories such as EBS Volumes, EC2 T instance burstable credits, NAT Gateways, and Data Transfer fees. Two actions are needed in Cost Explorer to see this.
First, select EC2-Other as the Service under Filters on the right. Then Group by Usage Type in the top bar. Since EBS Volumes and Elastic IPs are often forgotten about, these categories and the rest of EC2-Other are shown by default in Cost Reports within Vantage as separate line-items. Additionally, egress fees are associated with the specific NAT Gateways and EC2 Instances driving them where as that is ambiguous within Cost Explorer.
Credits can be pulled out specifically but show up as negative
Running out of credits is a formative experience for a new company on AWS. Amazon offers credits from $5,000 to $100,000 to start using AWS. Some key questions are what will the first bill look like and when will the first invoice with charges hit.
To see past and current credit spend you can select Charge Type under Filters on the right. By sure to use Include only as the filter type and then select Credit from the drop down menu. On the Cost Explorer dashboard credit spend appears as negative costs, but you can inverse it to see what your actual spend will look like.
Cost by Tagged Resources
Showing the per-unit cost to run a production application using cost allocation tags
One of the very best ways to get a handle on where money is being spent in the cloud is to establish a practice of tagging resources. Tags will not show up in Cost Explorer by default and must be enabled manually in the AWS console. There is no programmatic way to enable tags for cost allocation.
A common use case for tags is to assign a total cost to one application. In the image above
production-core is a service made up of several types of instances. It is set to the value of the tag and the key for the tag is an ECS cluster name. In this way I can see the per-unit cost for applications or business units.
It is important to note that Cost Explorer only begins to show costs of tagged resources from the moment you tag the resource and enable it for cost allocation and cannot go back retroactively. As a result, you’ll want to ensure your tagging policies are setup correctly from as early a point as possible.
Activating tags for use in billing reports
Remember how tags will not show up by default? Activating tags for use in cost reports is done in the Billing console, separate from Cost Explorer. In the graphic above, we have activated 2 ECS tags. Tags can also be activated in the Tag Editor.
With your resources tagged and ready for use in cost reports, you can find unused AWS resources and close them down or identify all resources which have not been tagged yet.
Group by a Tag or Multiple Tags
Grouping by one tag in Cost Explorer
With tags enabled, you can not only filter by them but group by them. Click More in the Group by row on top of the chart and find the tag. Note that you are grouping by the tag key and then each value is shown in color in the chart.
Filtering by multiple tags in Vantage
To group by multiple tags, you have a few options. You can connect cost and usage reports to built-in SQL query tools from AWS, you can query the API directly, or you can use Vantage tools which allow for filtering by an unlimited number of tags.
Number of Hours per Instance
Including hours used alongside costs
Sometimes instances are left running and there is a discrepancy between how much they cost and how much they are being used. To find this in Cost Explorer, you can use the Usage Type filter and set it to Include only. Then the number of hours used will show up alongside costs.
To automatically discover opportunities to reduce waste, you can use cost recommendations and shut down large instances.
Forecasting and Reserved Instances
Monthly spikes where RI charges show up. Note that you can show these on an amortized basis as well through filters
Reserved instances are upfront financial commitments to specific types of instances on AWS. In each month you should expect to see a spike for the monthly recurring reservation charges in each month during the duration of the RI term. In the Advanced Options section on the right you technically are able to select amortized costs to see these distributed by day. However this does not always work the way you may expect.
At the point when you are buying RIs you ought to be able to have strong forecasting as well. Financial planning tools can provide more power than the rough intervals and amortization shown in the screenshot above.
Savings plans seek to increase the amount of coverage for the AWS account. Cost Explorer does not really deal with Savings Plans directly. A common question is current level of commitment to various plans. Calculating this is not easy. Here are the steps.
- Enable CUR reports and setup a SQL tool
- Get the Savings Plan offer and setup a table with its data
- Use only on-demand hours across all your instances
- JOIN the filtered data with the pricing data from Savings Plans
Vantage is in preview for Autopilot, a feature that calculates coverage for savings plans and RIs while buying and selling those commitments on the customer’s behalf.
How to Set Permissions for Cost Explorer
Most medium to large organizations are using multiple AWS accounts. In this scenario, billing can become extremely complex. Fortunately, AWS Organizations can turn on Consolidated Billing so that bills for sub accounts flow through one management account. This is a best practice and highly recommended.