This repo illustrates how to estimate GCP energy consumption using data from the GCP Billing export in BigQuery. The script provided scans all resource usage over a trailing thirty day period and estimates consumption by using a hard-coded coefficient lookup table.
To run the script, modify the usage_by_jewel_class.sql file to point to your billing export table in BigQuery. Also be sure you have the Cloud SDK: Command Line Interface installed. Once you do, run the script shown below and you should see a similar output table representing your estimated trailing thirty day consumption estimates!
> ./cloud-jewels.sh -p my-billing-project
>
> Waiting on bqjob_r2a1f3145ee30850a_000001711743b581_1 ... (1s) Current status:
> DONE
+------------------+------+--------------------+
| jewel_class | skus | cloud_jewels |
+------------------+------+--------------------+
| CPU | 17 | xxxxxx.xx |
| Cloud Storage | 25 | xxxx.xx |
| Storage | 16 | xxxx.xx |
| SSD Storage | 4 | xx.xx |
| GPU | 4 | x.xx |
| Excluded Service | 281 | 0.0 |
| Network | 36 | 0.0 |
| Memory | 13 | 0.0 |
+------------------+------+--------------------+