gcloud spanner instances create and update labels
Introduced 2026-05-27 · score 0.92
HOW TO USE IT
When creating a Cloud Spanner instance, pass labels with `--labels`; when maintaining one, use `--update-labels` to add or change labels, `--remove-labels` to remove selected keys, or `--clear-labels` to remove all labels.
gcloud spanner instances create <INSTANCE_ID> --config=<INSTANCE_CONFIG> --description=<INSTANCE_NAME> --nodes=<NODE_COUNT> --labels=<KEY>=<VALUE>,<KEY>=<VALUE>gcloud spanner instances update <INSTANCE_ID> --update-labels=<KEY>=<VALUE>,<KEY>=<VALUE>gcloud spanner instances update <INSTANCE_ID> --remove-labels=<KEY1>,<KEY2>
gcloud spanner instances update <INSTANCE_ID> --clear-labelsWHY THIS HELPS
Set labels when creating or maintaining a Cloud Spanner instance.
REQUIREMENTS AND LIMITATIONS
- --labels=<KEY>=<VALUE>,…: List of label key-value pairs to add during creation. Keys and values allow lowercase letters, numbers, hyphens, and underscores.
- --update-labels=<KEY>=<VALUE>,…: Update existing label values or create new labels. Keys and values allow lowercase letters, numbers, hyphens, and underscores.
- --clear-labels: Remove all labels. Mutually exclusive with `--remove-labels`; if used with `--update-labels`, clearing is applied first.
- --remove-labels=<KEY>,…: Remove listed label keys; missing keys are ignored. Mutually exclusive with `--clear-labels`; if used with `--update-labels`, updates are applied first.
- INSTANCE_ID (required): Cloud Spanner instance ID.
- --config=<INSTANCE_CONFIG> (required): Instance configuration defining geographic placement and database replication.
- --description=<INSTANCE_NAME> (required): Instance description.
- Prerequisite: To view and manage instance labels, the docs require IAM permissions `spanner.instances.get` and `spanner.instances.update`; these are included in `roles/spanner.admin`.
FIRST-PARTY EVIDENCE
- https://docs.cloud.google.com/sdk/docs/release-notes#57000_2026-05-27
- https://docs.cloud.google.com/spanner/docs/labels
- https://docs.cloud.google.com/sdk/gcloud/reference/spanner/instances/create
- https://docs.cloud.google.com/sdk/gcloud/reference/spanner/instances/update
Check the installed version and the source before using it. Entry JSON