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
GSL LOGIC
VMInstance should have labels length() > 0
REMEDIATION
From Portal
- Go to the VM instances page using https://console.cloud.google.com/compute/instances
- Select the identified VM instance
- Click EDIT
- 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 = {
label_key='label_val'
}
..
}
From Command Line
Run
gcloud compute instances update INSTANCE_NAME --update-labels KEY1=VALUE1,KEY2=VALUE2
References
- https://cloud.google.com/sdk/gcloud/reference/compute/instances/update#--update-labels
- 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
Updated about 1 year ago