Skip to main content

Google Cloud tags and labels

Overview

Tags and labels both take the form of key-value pairs but serve different purposes in the Google Cloud resource hierarchy:

  • Tags are resources that can be attached to other resources directly or through inheritance. You can apply tags to your resources for cost allocation analysis or fine-grained access control.

  • Labels are metadata for resources and they allow you to annotate resources for cost analysis.

This page explains how to use tags and labels in DoiT Cloud Analytics reports.

Tags

Before a tag can be attached to a resource, you must first define the tag key and tag value in the Google Cloud. Once tags are propagated to BigQuery exports, which may take up to an hour, they become available in DoiT Cloud Analytics reports within hours.

See also

When using the Filter results or Group by options in a Cloud Analytics report, you'll find the available tags in the Tags section.

The example below uses the tag key vpc1-tag and standard dimensions (Service, Project/Account ID, SKU) to analyze cost.

A report with Google Cloud tags

Labels

Labels can be used to group related Google Cloud resources.

Because of Google Cloud's frequency of data loads and other limitations, after applying labels to your resources, it may take a few days before the labels become available in the DoiT console.

See also

When using the Filter results or Group by options in a Cloud Analytics report, you'll find the available labels in the Labels section (Available system labels appear in the System Labels section).

Auto labeling with Iris 3

Iris 3 is an open-source project developed by DoiT.

Iris 3 automates the labeling of various types of Google Cloud resources. For example, a Google Compute Engine instance would be labeled with iris_name:nginx, iris_region:us-central1, and iris_zone:us-central1-a.

You can configure Iris 3 to run on resource creation or at a scheduled time. Labels added by Iris 3 are available both in the DoiT console and in the Google Cloud Console.

Example: Label Cloud Storage buckets

The example below explains how to label storage buckets and then use the labels to break down the cost in a Cloud Analytics report.

Tip

Beginning February 13, 2024, granular Cloud Storage bucket-level cost data is available in the Cloud Billing Detailed cost export. See GCS Cost by Bucket for how you can use the Global resource dimension to break down storage costs by bucket.

Suppose you've created three buckets and want to label them using the bucket names:

  1. Sign in to the Google Cloud console, go to the Cloud Storage Buckets page.

  2. Locate the target bucket in the bucket list, select its Bucket overflow menu (), and then select Edit labels.

  3. Select + Add label and specify its key and value. For example: bucket-name: bucket-demo

    Label a Google Cloud Storage bucket

  4. Save the changes.

Note

After applying labels to your buckets, it may take a few days before the labels become available in the DoiT console; the billing data with the label needs to arrive in the billing export, and the report metadata needs to update.

To use labels in Cloud Analytics reports:

  1. Log in to the DoiT console, go to the main Reports screen to create a new report.

  2. Use the Group by option, select Service from the Standard section, filter it to include only Cloud Storage (GCS), and then select bucket-name from the Labels section.

  3. Run the report to see the cost of each bucket.

    The example report below combines two other standard dimensions (Project/Account ID, SKU) to identify granular cost data.

    A report with Google Cloud Storage bucket labels