Ensure GCP VM Instances have Labels

Labels can be used to identify or search your instances. In order to control your project, all resources should have meaningful labels.

Risk Level: Low
Cloud Entity: Virtual Machine Instances
CloudGuard Rule ID: D9.GCP.AS.09
Covered by Spectral: Yes
Category: Compute


VMInstance should have labels length() > 0


From Portal

  1. Go to the VM instances page using https://console.cloud.google.com/compute/instances
  2. Select the identified VM instance
  3. Click EDIT
  4. Click Add labels and add meaningful Key:Value information for your instance

From TF
Set the label KEY:VALUE in the node 'labels':

resource 'google_compute_instance' 'default' {
	labels = {

From Command Line

gcloud compute instances update INSTANCE_NAME --update-labels KEY1=VALUE1,KEY2=VALUE2


  1. https://cloud.google.com/sdk/gcloud/reference/compute/instances/update#--update-labels
  2. https://cloud.google.com/compute/docs/labeling-resources

Virtual Machine Instances

Compute Engine instances can run the public images for Linux and Windows Server that Google provides as well as private custom images that you can create or import from your existing systems. You can also deploy Docker containers, which are automatically launched on instances running the Container-Optimized OS public image.

You can choose the machine properties of your instances, such as the number of virtual CPUs and the amount of memory, by using a set of predefined machine types or by creating your own custom machine types.

Compliance Frameworks

  • CloudGuard GCP All Rules Ruleset
  • GCP CloudGuard Best Practices
  • GCP CloudGuard CheckUp
  • GCP ISO 27001:2013
  • GCP NIST 800-53 Rev 4
  • GCP NIST 800-53 Rev 5