Best Practices from Oracle Development's A‑Team

Working with OCI Cost Reports

OCI has recently started providing new daily csv reports that include cost data for each resource instance.  The Cost Reports incorporate fields like SKU, mycost, billedQuantity, and billingUnit that allow to do data mining and analytics on resource instance usage and cost down to the hour.  More information on the included fields for both reports can be found in the documentation.

A difference between the new Cost Reports and the Usage Reports, besides the cost related fields, is the inclusion of usage/cost data for non-native services like CASB, OMC, Analytics, BlockChain, etc. in the Cost Report. These services can be distinguished from the others by an empty compartment field in the csv file as in the following example:


Before the release of Cost Reports the only way to obtain this degree of detail on cost data was to combine information from the Metering API with Usage Reports.

The Cost Reports are located in the same Object Storage Bucket as the Usage Reports.  To access them with OCI Console, go to Account Management->Usage Report



From the report list, notice that the Cost Reports have a different prefix from the Usage Reports, for example:

Cost Report name:       reports/cost-csv/000X0000000XXXXX.csv
Usage Report name:    reports/usage-csv/000Y0000000YYYYY.csv


If you are using a script with an OCI SDK to retrieve reports and you want to get a list of only one type of report, you can use the prefix argument in the object_storage.list_objects call to do so, for example in python:

report_list = oci.pagination.list_call_get_all_results(object_storage.list_objects, report_namespace,report_bucket,prefix="reports/cost-csv",fields='name,size,timeCreated')

This call will retrieve only Cost Reports.  If you want to retrieve both types of reports in the same list, just remove the prefix argument:

report_list = oci.pagination.list_call_get_all_results(object_storage.list_objects, report_namespace,report_bucket,fields='name,size,timeCreated')

You can find an example for downloading reports using the API here.

The OCI Cost Reports introduce a new simpler way to obtain and analyze usage and costs for all resources in your tenancy.  The csv files can be ingested and processed with Business Intelligence and Analytics tools that can process the cost data for better visualization and clarity.

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.Captcha