Chapter 3. Configuring tags and labels in cost management

You must configure tags in each source before cost management can use the tags to automatically organize your cost data.

After adding your sources to cost management:

  1. Tag or label resources on each of your sources. See Section 3.2, “Configuring tags on your sources”.
  2. Refine and add to your tags to optimize your view of cost data. See Section 2.2, “Considerations for your tagging strategy”.

See the Getting started with cost management guide for instructions on configuring sources.

3.1. How cost management associates tags

Tags in AWS and Azure and labels in OpenShift consist of key:value pairs. When the key:value pairs match, the AWS/Azure and OpenShift costs are automatically associated by cost management. Tag matching in cost management is not case sensitive: for example, an AWS resource tagged APP and an OpenShift resource tagged app are a match:

Table 3.1. Example: Tag matching

Source and resource typeKeyValue

AWS resource (RDS)



OpenShift pod



If an AWS resource tag matches with multiple OpenShift projects, the cost and usage of that resource are split evenly between the matched projects.

This is not the case with AWS compute resources that are matched through the instance ID-node relationship. In that case, cost and usage are broken down using information about a project’s resource consumption within the OpenShift cluster.

By default, cost management tracks AWS compute usage and costs by associating the Amazon EC2 instance ID or Azure virtual machine instance ID with the OpenShift Container Platform node running on that instance.

3.1.1. Tag matching hierarchy in cost management

To identify your OpenShift resources running on AWS or Azure instances, cost management matches tags between sources in the following order:

  1. Direct resource matching (AWS EC2 instance ID or Azure virtual machine instance ID)
  2. Special OpenShift tags
  3. Custom tags

3.1.2. OpenShift label inheritance in cost management

OpenShift labels follow an inheritance pattern from node → project → pod. Key/value pairs from node and project labels are inherited at the pod level in cost management. This allows you to associate costs at the node or project level without labeling every pod in your cluster.

If a key already exists in the pod, then the value for that key in the pod will remain. Cost management will not overwrite the pod value with the project or node value. This same logic applies from node to project.

Example 1: Your organization assigns the label app and the value costpod1 to a pod. The project for this pod has the label app but the value cost-project. These resources are running on a node with the label us-east-1. The label app and the value costpod1 will remain associated with the pod as it is the lowest level.

Example 2: Your organization has a project with the label app and the value cost-project. This project has three pods running and they have not been labeled. Cost management will associate the label app and the value cost-project to these pods.

3.1.3. Direct resource matching (instance ID)

The sources apply these identifiers automatically. This form of tagging provides a direct link between Azure or AWS instances and OpenShift nodes.

AWS assigns every EC2 instance a resource identifier (a number such as i-01f44b3d90ef90055). OpenShift nodes are matched directly to the AWS EC2 instance the cluster is running on using the AWS resource identifier. The OpenShift reports in cost management (generated from Prometheus data) include this identifier for nodes. Similarly in Azure, each virtual machine instance ID is included in the OpenShift reports for cost management.

3.1.4. Special OpenShift tags

There are three special-case AWS tags you can use to associate cost with OpenShift:

  • openshift_cluster
  • openshift_node
  • openshift_project

These tags have matching priority over custom tags, and are especially useful in differentiating the costs of different OpenShift clusters running on the same AWS instance.

To use this tagging method to identify an OpenShift cluster, tag your AWS instance with the key openshift_cluster, and provide the OpenShift source name as the value. In the following example, the name of OpenShift source in the cost management application is dev-cluster:

Table 3.2. Example: Special OpenShift tags

Source and resource typeKeyValue

AWS resource (RDS)



OpenShift cluster

No tags needed. This will match if the name of the OpenShift source in cost management is dev-cluster.

No tags needed.

3.1.5. Custom tags

You can use any key:value combination as tags, and cost management will associate identical tag key and values together. You can then group costs by tag key, account, service, region, and more to view your costs and charge for that tag.

Table 3.3. Example: Custom tags

Source and resource typeKeyValue

AWS resource (RDS)



OpenShift pod



3.2. Configuring tags on your sources

To control the tags cost management imports, activate or enable the tags you want to view by source:

  • AWS tags must be activated, and are then selected and exported to cost management in the Cost and Usage report. See Activating AWS tags for cost management in the Adding an Amazon Web Services (AWS) source guide for instructions.
  • Microsoft Azure tags are exported to cost management in the cost export report configured in Configuring a daily Azure data export schedule.
  • OpenShift Container Platform labels are exported by Metering and included in the metrics reports that cost management uses as input.

3.2.1. Adding tags to an AWS resource

Amazon creates certain identifiers automatically, like the EC2 instance resource identifier (a number such as i-123456789), which cost management uses similarly to a tag.

You can also add your own tags at the individual resource level. These tags must be activated for Cost and Usage Reporting to export them to the cost management application.

Configure AWS tags for cost management using the following steps:


  1. Create and apply tags to your AWS resources.

    See User-Defined Cost Allocation Tags in the AWS documentation for instructions.

  2. Activate the tags you want to be collected by the cost management application through the Cost and Usage Report. In the AWS Billing console, select the tags you want to activate from the Cost Allocation Tags area.

    See Activating the AWS-Generated Cost Allocation Tags in the AWS documentation for instructions.

3.2.2. Adding tags to an Azure resource

Adding an Azure source creates identifiers for virtual machine instances automatically, which cost management uses similarly to tags to associate Azure resources to related OpenShift resources.

You can also add your own tags in Azure at the individual resource level.

Create and apply Azure tags for cost management using the instructions in the Azure documentation: Use tags to organize your Azure resources and management hierarchy.

3.2.3. Adding tags to a Google Cloud resource

You can apply custom labels to Google cloud resources, such as virtual machine instances, images, and persistent disks. These labels are automatically added to your BigQuery export and sent to cost management.


  • Create and apply labels to your Google Cloud resources.

    See Creating and managing labels in the Google Cloud documentation for instructions.

3.2.4. Viewing labels in an OpenShift namespace

The AWS or Azure tag equivalent in OpenShift is a label, which also consists of a key:value pair. The cost management service collects OpenShift tag data from nodes, pods, and persistent volumes (or persistent volume claims) using Prometheus metrics and Cost Management Metrics Operator.

To view the available tags, navigate to a resource in the OpenShift web console. Any assigned labels are listed under the Labels heading, for example:

3.2.5. Enabling and Disabling tags in cost management

All cloud provider tags are activated in cost management by default. Sometimes having too many resource tags can affect cost management performance. Enabled tags are limited to 200 per account. Unnecessary tags can also make managing your costs more complicated when grouping tags and matching key:value pairs. Disable tags you are not actively using to reduce these potential issues.


  • You must have Organization Administrator or Cost Price List Administrator privileges to change these settings in cost management. See Limiting access to cost management resources in Getting started with cost management for more information about user roles and access.


  1. From cost management, click Cost ManagementSettings.
  2. Click the Tags and labels tab.
  3. Select the tags you want to disable.
  4. Click Disable tags.

    This tag is now deactivated for the cost management application. You can enable tags you have disabled on the same page by selecting the tags you want to enable and clicking Enable tags.