Consumption Insight with the API

By | February 1, 2019

If you start using the Oracle Cloud (OCI), you want to of course have a good understanding about your spending. The Oracle Cloud provides you with some special tools to manage your consumption.

One of them being cost-tracking tags. On each object / service in the Oracle Cloud you can apply cost-tracking tags, these tags can then later be used in consumption overviews to understand what the money was spend on.
More on tags here:

https://docs.cloud.oracle.com/iaas/Content/Identity/Concepts/taggingoverview.htm?Highlight=tags

In the “My Services” dashboard you can view the consumption based on the cost-tracking tags or compartments.

Automation

If you want to do some automation around the consumption, the Oracle Cloud offers an API for this. This is a different API then the OCI API and requires just an username/password instead of ssh keys.

You can find more details about the various API / Rest services here:

https://docs.oracle.com/en/cloud/get-started/subscriptions-cloud/meter/rest-endpoints.html

Martin Bridge, an Oracle employee has written a simple example in python on how these API’s can be used.

You can find Martin’s script here:

https://github.com/bridgem/oracle-cloud

4 thoughts on “Consumption Insight with the API

  1. William

    Very nice stuff. I have a short question, where do you get the details of the domain and idcs_guid?

    domain = cacct-8lfcde8lfcde8lfcde8lfcde8lfcde8l
    idcs_guid = idcs-21bca21bca21bca21bca21bca21bca21

    Thx in advance

    Reply
    1. richard Post author

      Go to the “My Services Dashboard”, if you are in the OCI portal, you can find this link in the “Administration” menu.

      Click on the “4 horizontal lines” icon from any service and chose “View Details”. If you do not have any services show, click on customize dashboard to have a service displayed.

      On that page you will find the domain in the field “Cloud Account ID” and the idcs_guid in the “Identity Service Id” field.

      Reply
  2. Raj Gupta

    Thanks for sharing!
    I am having some questions, Can we have cost details as per tagging namespace.. in our tenancy we have created tag for each environment and applied the same to environment specific resources. Now we wanted to get the cost analysis for specific time frame and specific tag. We can find the same from OCI Portal but we want something like reports not dashboard type.

    Thanks in advance

    Thanks
    Raj Gupta

    Reply
  3. Gustavo

    Hi,
    with the new oracle cloud portal I dont think you can get those domain and idcs_guid

    How can I use this API without it ?
    thanks

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.