Flex Report for Analyzing GCP Compute Costs by Machine Series
You can utilize the following Flex report query to retrieve compute costs based on machine series. This report is designed using the "GCP BigQuery Billing Export" dataset, with the `machine_spec` column values sourced from the billing data.
{
"sqlStatement": "SELECT timeInterval_Month AS TimeInterval_Month, Cost_Type AS Cost_Type, Region AS Region, SUM(Cost) AS SUM_Cost, SUM(Total_Credits) AS SUM_Total_Credits, Service_Description AS Service_Description, Project_Id AS Project_Id, ELEMENT_AT(gcp_System_Labels_Map, 'compute.googleapis.com/machine_spec') AS gcp_System_Labels_Map_compute_googleapis_com_machine_spec FROM GCP_BILLING_EXPORT WHERE (Cost_Type LIKE '%regular%') AND (Credit_Name IS NULL) AND (Service_Description LIKE '%Compute Engine%') AND (Project_Id IS NOT NULL) GROUP BY timeInterval_Month, Cost_Type, Region, Service_Description, Project_Id, ELEMENT_AT(gcp_System_Labels_Map, 'compute.googleapis.com/machine_spec')",
"dataGranularity": "MONTHLY",
"timeRange": {
"last": 12
},
"limit": -1
}
Please note:
1. Categorize the report according columns ELEMENT_AT(gcp_System_Labels_Map, 'compute##googleapis.com/machine_spec') to get report categorized in Machine series.
2. The values in the report are derived from GCP bills. If there are no corresponding details in the GCP bill, the machine type will appear as blank in the report.