Cost Categories

Written by

Aditya Datta

Save Before You Pay

Try our full-featured trial.

Cost Categories is a new feature AWS is introducing into the Billing module. It is an excellent tool to categorize costs that allows you to have different views of your AWS Cost Data.

Unleashing the full Potential

In addition to understanding how the costs are to be sliced, we also need to identify which department, team, business unit a given cost category belongs to. This is not available in AWS console, but with proper tooling, you can integrate Cost Categories with reporting metadata.

By adding in metadata for owner, email, slack channel or any kind of notification scheme to the cost categories, you can lay the foundation of cost governance and reporting on AutoPilot and integrate with existing workflow tools at your Enterprise.

For example, here at Cloudwiry, we have designed our Cost anomaly governance process using Cost Categories and owner/team metadata. This enables cost reporting of any unexpected cost increases and anomalies to the right team(s) and business owners, enabling prompt remedial action. interested in learning more? Schedule a demo with us.

Setting up Cost Categories

Cost Categories can be used with an individual AWS account or at the master payer account level, enabling you to slice the AWS costs in a manner best suited for your needs.

The access to the functionality is through the billing module, under the Cost Categories (beta) button. The main concept here is the category, whether you want to classify the costs using Stage environment, Product, Department in the organization. The other important concept is the rule. A rule is a condition to apply the cost to a particular value inside a category. And finally, the values inside a category are the different options of it. The rule will try to allocate the cost items from the billing into the value. The value of a category can be repeated in different rules and the costs will be sum up. That’s useful if different criteria apply to categorize the item.

At the moment, there are two distinct criteria to classify the costs: AWS Accounts and Tags. Within a rule, it’s possible to define several options for AWS Accounts and Tags. If both Account and Tags options are enabled, then both must be met. It’s interesting to note that if there are several rules whose conditions overlap, then the first one matching will apply. For that reason, under the same category, the total cost for all the values would never be higher than the total costs.

Quick TIP: If two rules are overlapping, the first one takes precedence. That is useful to have a fallback category to gather all the costs for shared resources without losing the ability to identify a specific value.

As a simple example, let’s say you have a central account (Shared_Account) and the resources have a Tag environment (with a value of ‘development’ and ‘qa’). Moreover other misc resources are launched in this account. The need is to allocate all development costs to CostCenter of 4900 and QA costs to CostCenter 4761 and everything else is considered overhead with CostCenter of 8008. This can be setup as follows:-

Cost Category: Cost Center

Rule 1:

  • Conditions:
    • AWS Account = [ Shared Account ]
    • Tag:Environment = [ development, dev, devel ]
  • Value: Cost_Center_4900

Rule 2:

  • Conditions:
    • AWS Account = [ Shared Account ]
    • Tag: Environment = [ qa ]
  • Value: Cost_Center_4761

Fallback Rule 3:

  • Conditions:
    • AWS Account: Shared Account
  • Value: Cost_Center_8008
Example

In this particular example, we have created three different views as described earlier: by the department, by product, and by stage.

Usually, the stage is selected using the Tag company:environment, and if there is no tight tag enforcement, it might be interesting to use several options for each value: production with {prod, production}, staging with {staging, stage}, qa with {qa, test} and dev with {engineering, dev, devel}.These rules can be expressed in JSON as follow:

{
	"RuleVersion": "CostCategoryExpression.v1",
	"Rules": [
		{
			"Value": "production",
			"Rule": {
				"Tags": {
					"Key": "cw:environment",
					"Values": [
						"prod",
						"production" ] } } },
		{
			"Value": "staging",
			"Rule": {
				"Tags": {
					"Key": "cw:environment",
					"Values": [
						"staging",
						"stage" ] } } },
		{
			"Value": "qa",
			"Rule": {
				"Tags": {
					"Key": "cw:environment",
					"Values": [
						"qa",
						"test" ] } } },
		{
			"Value": "dev",
			"Rule": {
				"Tags": {
					"Key": "cw:environment",
					"Values": [
						"engineering",
						"dev",
						"devel" ] } } } ] }

Got a few more minutes? You might want to check out the following:

Save Before You Pay

Try our full-featured trial.