6 Answers
GCP does not allow you to add tag to instances in a managed group via Console anymore. But you can still do that via gcloud
command (from Cloud Shell or from your computer).
gcloud compute instances add-tags test-instance –tags=tag-1,tag-2
Thanks 🙂 i used this : gcloud compute instances add-tags
confirmed. but the video must be updated since it is not possible to do this with web console
The above did not work, as it’s missing the region. This syntax worked gcloud compute instances add-tags [INSTANCE-NAME] –zone [ZONE] –tags [TAGS] Details here: https://cloud.google.com/vpc/docs/add-remove-network-tags#gcloud_2
I’m still having issues writing the command with the proper syntax. Can someone help?
Instance name: frontend-instance-g-9hpm
gcloud compute instances add-tags [frontend-instance-g-9hpm] –zone [us-west1-a] –tags [open-ssh-tag]
I get this error: Invalid value ‘[frontend-instance-g-9hpm]’. Values must match the following regular expression: ‘a-z?|[1-9][0-9]{0,19}’
Square brackets are not allowed. Try the same command without the square brackets: gcloud compute instances add-tags frontend-instance-g-9hpm –zone us-west1-a –tags open-ssh-tag
that worked, thanks Marcos!
This worked for me:
gcloud compute instances add-tags
The gcloud command works to add the tag. Using the instance name and zone example from the video that liked to this thread, the instructor would have needed to type the following command into his cloud shell.
gcloud compute instances add-tags frontend-ig-6hpf –zone us-west1-a –tags open-ssh-tag
So when you type it into your own cloud shell change "frontend-ig-6hpf’ to the name of your instance. And change "us-west1-a" to the zone your instance is in. for example my command looks like this
gcloud compute instances add-tags frontend-instance-group-wblv –zone us-west1-b –tags open-ssh-tag
I hope that clears up any confusion anyone might have. Let me know if you need more details. Sometimes the smallest of details can block a full understanding of a topic. I have been stuck on small details before and it can be terribly frustrating!
Thanks Rob.
+1