Search code examples
google-cloud-platformgoogle-bigquerybilling

GCP - Is there a way to get bill line items at Instance level


GCP provides a mechanism to export billing data to BigQuery. This is really helpful but what it lacks is to provide cost line items at the Instance level (or at least I could not figure out a way). We can get cost aggregates at SKU, Project, Service level, but more granularity is required. This is very much possible with Azure and AWS.

Following are the columns I see in the exported BigQuery Billing table;

billing_account_id, invoice.month, cost_type, service.id, service.description, sku.id, sku.description, usage_start_time, usage_end_time, project.id, project.name, project.ancestry_numbers, project.labels.key, project.labels.value, labels.key, labels.value, system_labels.key, system_labels.value, location.location, location.country, location.region, location.zone, cost, currency, currency_conversion_rate, , usage.amount, usage.unit, usage.amount_in_pricing_units, usage.pricing_unit, credits.name, credits.amount, export_time

Is there a workaround to fetch cost aggregates at Instance level?

Example: If I have subscribed for 2 Compute Engines of a specific SKU. Is there a mechanism to get cost aggregates for each Compute Engine separately?


Solution

  • At the moment its not possible to filter your reports in instance level and SKU is the most granular filter.

    An approach you can use to identify your instances and a get a better understanding of your data is using labels. As you can see here :

    A label is a key-value pair that helps you organize your Google Cloud instances. You can attach a label to each resource, then filter the resources based on their labels. Information about labels is forwarded to the billing system, so you can break down your billing charges by label.


    In this document which explains the billing data table's schema you can see that the labels attached in your resource will be present in your data.

    enter image description here