Jump to Content
Google Cloud

Use labels to gain visibility into GCP resource usage and spending

December 12, 2017
Chris Crall

Product Managers

Marco Cavalli

Product Manager

We’re pleased to announce that labels, a new grouping mechanism for your cloud resources, is now widely available in GCP. With labels, you can group related resources together by adding metadata to your resources in the form of key-value pairs. This feature helps enterprises better organize resources, and gain visibility into resource usage and spending.

At Descartes Labs, we process petabytes of satellite imagery on a daily basis that we store in GCP. We use labels to tag our Google Cloud Storage buckets by functional business area so that we have better visibility into how resource usage looks across departments. We also use labels with Google Compute Engine to identify the processing pipelines across different areas of our environment so that we have an accurate view of how resource costs map to our business. We can easily track any cost changes by exporting resource billing details to Big Query and using Data Studio Dashboards.

—Tim Kelton, Co-Founder and Cloud Architect, Descartes Labs

Labels provide a convenient way for developers and administrators to organize resources at scale

By adding labels such as costcenter=c23543, service=playlist, and environment=test to your VMs or GCS buckets it’s easy to understand, for example, where your resources are deployed, for what purpose and which cost center they should be charged to.

The screenshot below shows how you can associate labels with Compute Engine instances through the UI.

Labels can be used to associate your GCP resources with your cost center of choice.

You can also, for example, further subdivide the playlist service into the systems that represent the web front-end and a different set of resources that represent a storage system (e.g., a Cassandra cluster). By assigning the labels component=frontend to all the web front-end resources, and component=storage to the Cassandra cluster, you can search and filter to find just the VMs that make up the front-end, as shown in the screenshot below.

Use labels to search and filter on specific GCP resources.

Using labels to understand costs

When you enable the export of billing data to BigQuery, labels are exported to BigQuery with all corresponding GCP resources and their usage. This makes it easier for CIOs and managers to answer questions such as:

  • What does the shopping cart service in my application cost to run?
  • How much do I spend on developer test machines?

You can use BigQuery in combination with labels such as costcenter=c23543, service=playlist, and environment=test on your VMs or GCS buckets, to understand exactly what all test systems resources cost versus production resources, or how much the playlist service costs.

Here, Billing export to BigQuery has been enabled. "Labels-demo-prj" is the source of your resource usage and "labels_demo_bqexport" is the destination dataset where usage data is stored.

Once you export your usage and labels to BigQuery, finding out how much your “playlist” service costs becomes very easy, as shown in the example below.

Here, you can see Google Compute Engine usage and its associated cost in BigQuery.

Labels are a powerful tool to track your GCP usage and resources at scale, and with the granularity you need. You can find a list of all GCP services that support labels today on the documentation page. Stay tuned as we announce more features for labels.

Posted in