Load OCI cost report
Overview
Expand or personalize reporting or visualizations are an very common requirement.
Extend reports can be difficult in this sample we have how to make more simple and flexible this task.
Benefits of this approach will be better understand the patterns of consumption and be able to explore using the raw consumption data in a easy way.
OCI offer an capability called cost report customers can download all cost related information of cloud subscription. The concept here is load OCI cost report into Elasticsearch.
Elasticsearch
The GitHub project version 1.0 load OCI cost report file contents to Elasticsearch creating an index called “cost”.
Cost report will be indexing as an document as a result of this operation will make easy the use of Elasticsearch and Grafana to build the dashboards.
This project can be found in load_cost git project.
Check on how to deploy Elasticsearch blogpost.
Requirements
The access to this capability must be enabled. For this follow the steps described in OCI documentation.
To run the python script the environment also require the following modules bellow.
oci
gzip
pandas
shutil
configparser
elasticsearch
How this script works
Cost reports are files that resides in a specific bucket. The script downloads the files use the identification field as index id to avoid duplicity of records and also tracks the files already processed and indexed into Elasticsearch.