Is there a way to automatically apply Labels to instances that are launched by a GCE Managed Instance Group (aka. Instance Group Manager)? I see that you can add Network Tags in the Instance Template (properties.tags
), but I don’t see a way to add Labels for use in searching for labeled instances using instances/list
.
A workaround would be to manually call setLabels
on instances from the Instance Template’s startup-script
.
In AWS EC2, the equivalent would be to add Tags to an AutoScalingGroup with PropagateAtLaunch: true
.
Labels are currently a beta feature. You can use the following command to create Compute Engine instance template with labels for your managed instance groups:
gcloud beta compute instance-templates create NAME --labels=[KEY=VALUE,…]