Tools for monitoring, analyzing and optimizing cost have become an important part of managing development. The purpose of this script is to provide daily and month to date cost of resources utilized on GCP.
- Enable Export Billing Data to BigQuery
- Install Python
- Install google-cloud-bigquery module
Before running this script, you need to modify some parameters:
- Set GOOGLE_APPLICATION_CREDENTIALS environment variable Or Provide path to Google application credentials file
- Set PROJECT_ID, DATA_SET , TABLE_NAME variables
- Run using following command
python gcp_billing.py
Note: If you are providing GOOGLE_APPLICATION_CREDENTIALS as an environment variable to the script then comment the line number 11 of script.