Tracking Costs with Oracle Cloud Infrastructure Tagging

We understand the importance of being able to attribute the right Oracle Cloud Infrastructure usage costs to the right department or cost center in your organization. Oracle Cloud Infrastructure enables you to track costs at the service or compartment level by using the My Services dashboard, but our users also need the flexibility to track costs for projects that have resources across multiple compartments or that share a compartment with other projects.

With that in mind, I'm pleased to announce that we are introducing cost tracking tags, which allow you to tag resources by user, project, department, or any other metadata that you choose for billing purposes. A cost tracking tag is in essence a type of defined tag that is sent to our billing system and show up on your online statement in the My Services dashboard. This feature builds on our easy-to-control, schema-based defined tagging approach. While other clouds support free-form tags, Oracle Cloud Infrastructure offers better control by providing defined tags. Defined tags support a schema to help you control tagging, ensure consistency, and prevent tag spam; all critical attributes when it comes to ensuring proper usage and billing management.

Read my prior blog post as a primer for setting up defined tags.

Creating Cost Tracking Tags

Let's explore how you can create a cost tracking tag and how it flows through the system so that you can attribute costs. We'll start by looking at a tag namespace that I defined in the Oracle Cloud Infrastructure Console.

Note the new field, Number of Cost-tracking Tags. This value shows all the cost tracking tag definitions in the tag namespace. The number is important to know because you can have a maximum of 10 cost tracking definitions at any given time.  

Now, let's see how I set up my cost tracking tags. I need to track my costs along four separate dimensions, so I set up four cost tracking tags:

  • CostCenter is the internal department to which these costs are attributed.
  • Project groups customers together inside a single product offering.
  • Customer is the customer to which the usage is billed.
  • Customer_Job is the actual job that is running on the Compute instance.

Note that three of these tags already show Cost-tracking set to Yes, which indicates that they are sent to Oracle's billing system. Customer_Job has Cost-tracking set to No, which is in error, so I need to convert this defined tag to a cost tracking tag.

To do that, I open the Customer_Job tag key definition, click the pencil icon next to Cost-tracking: No, and select the Cost-tracking check box.

Now that these tag key definitions are set up as cost tracking, the tags are included in the usage data sent to My Services. When a tag is marked as cost tracking, it can take from two to four hours before it’s processed by My Services and included in the online statement.

Viewing Cost Tracking Tags in My Services

You can now view these tags in the My Services dashboard. After logging in to My Services, click Account Management and select a filter based on a cost tracking tag. As shown in the following screenshot, you can filter your costs based on the cost tracking tags that you define and determine how much cost a particular cost center (for instance, a Finance department) has incurred. This example shows the costs associated with a database I was running with the tag Finance:CostCenter=w1234.

Not only can you see this information in the My Services dashboard, but you can also download the results into a CSV file, which is ideal for analyzing in Excel or other tools.

If you want to automate the process of gathering cost-tracking data by tag by using the API, you can do that as well. You can use the API documentation to get started, but following is an explicit example. This is a sample URL that I made of the Metering API service:

    https://itra.oraclecloud.com/metering/api/v1/usagecost/cacct-{your caact}/tagged?

The URL now includes /tagged to indicate that you are filtering for a particular tag. The tag field must be URL encoded, which means that you must convert the colon (:) to %3A and the equal sign (=) to %3D. In this example, I used CostTracking:CostCenter=w1234, which URL encoded is CostTracking%3ACostCenter%3Dw1234.

The following example shows the costs associated with a database I was running with the tag Finance:CostCenter=w1234.

    "accountId": "cacct-your caact",
    "canonicalLink": "/metering/api/v1/usagecost/cacct-caact /tagged?timeZone=America%2FLos_Angeles&startTime=2018-09-01T00%3A00%3A00.000&endTime=2018-10-04T00%3A00%3A00.000&computeTypeEnabled=Y&tags=Finance%3ACostCenter%3Dw1234&usageType=DAILY&rollupLevel=RESOURCE",
    "items": [
            "costs": [
                    "computedAmount": 19.44,
                    "computedQuantity": 48.0,
                    "overagesFlag": "N"
            "currency": "USD",
            "endTimeUtc": "2018-09-19T17:00:00.000",
            "gsiProductId": "B88331",
            "resourceDisplayName": "Database Standard Added CPUs",
            "startTimeUtc": "2018-09-18T17:00:00.000",
            "tag": "Finance:CostCenter=w1234"

Please add your comments and question in the comments section below if you have questions about how cost tracking tags can benefit your organization.

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.