Attach and manage tags on AlloyDB resources

This page describes how to attach, detach, and list tags on AlloyDB resources. For an overview of tags on AlloyDB, see Organize AlloyDB resources using tags.

Before you begin

To get the permissions that you need to view and set tags on AlloyDB resources, ask your administrator to grant you the following IAM roles on your project:

  • Cloud AlloyDB Admin (roles/alloydb.admin): assign to set and view tags
  • Cloud AlloyDB Viewer (roles/alloydb.viewer): assign to view tags

For more information about granting roles, see Manage access.

You might also be able to get the required permissions through custom roles or other predefined roles.

Work with tags

After you've created and defined a tag using Resource Manager, you can start using tags with AlloyDB cluster and backup resources. For more information about the Google Cloud CLI commands to use tag bindings, see gcloud resource-manager tags bindings.

For all of the commands on this page, replace the following:

  • PARENT_PATH: The complete path to the backup or cluster resource—for example, //
  • TAG_VALUE: The tag value that you want to attach to your resource—for example, the tag value set as 815471563813/environment/development includes the following components:

    • 815471563813 is the organization ID or your project ID.

    • environment is the tag key.

    • development is the tag value.

  • LOCATION: The region where your cluster or backup is placed—for example, us-central1.

Attach tags to AlloyDB resources

gcloud resource-manager tags bindings create \
--parent=PARENT_PATH \
--tag-value=TAG_VALUE \

Detach tags from AlloyDB resources

gcloud resource-manager tags bindings delete \
--parent=PARENT_PATH \
--tag-value=TAG_VALUE \

List tags on AlloyDB resources

gcloud resource-manager tags bindings list \
--parent=PARENT_PATH \

What's next