Created
April 15, 2020 18:23
-
-
Save yihyang/53c54195718476ac60563d92094cd8e5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Understanding Your Google Cloud Costs | |
# Analyzing Billing Data with BigQuery | |
SELECT * FROM `billing_dataset.enterprise_billing` WHERE Cost > 0 | |
SELECT Line_Item FROM `billing_dataset.enterprise_billing` GROUP BY Line_Item | |
SELECT Line_Item, COUNT(*) as NUM FROM `billing_dataset.enterprise_billing` GROUP BY Line_Item | |
SELECT Project_ID, COUNT(*) as num FROM `billing_dataset.enterprise_billing` GROUP BY Project_ID | |
SELECT SUM(cost) as Cost, Project_Name FROM `billing_dataset.enterprise_billing` GROUP BY Project_Name | |
# Visualizing Billing Data with Data Studio | |
SELECT service.description FROM `ctg-storage.bigquery_billing_export.gcp_billing_export_v1_01150A_B8F62B_47D999` GROUP BY service.description | |
SELECT * FROM `ctg-storage.bigquery_billing_export.gcp_billing_export_v1_01150A_B8F62B_47D999` | |
SELECT service.description, COUNT(*) AS num FROM `ctg-storage.bigquery_billing_export.gcp_billing_export_v1_01150A_B8F62B_47D999` GROUP BY service.description | |
SELECT location.region FROM `ctg-storage.bigquery_billing_export.gcp_billing_export_v1_01150A_B8F62B_47D999` GROUP BY location.region | |
SELECT location.region, COUNT(*) AS num FROM `ctg-storage.bigquery_billing_export.gcp_billing_export_v1_01150A_B8F62B_47D999` GROUP BY location.region | |
# Examining BigQuery Billing Data in Google Sheets | |
SELECT * | |
FROM billing_dataset.enterprise_billing | |
SELECT Account_ID, Measurement1_Total_Consumption, Measurement1_Units, Credit1, Credit1_Amount, Credit1_Currency, Cost, Currency, Project_Number, Project_ID, Project_Name, Description | |
FROM billing_dataset.enterprise_billing | |
WHERE Project_Name IN ('CTG - Dev','CTG - Prod') | |
ORDER BY Project_Name |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment