I have 100's of GCP Batch VMs running, and `gcloud compute config-ssh` includes ALL of them, when I just want the few VMs not running via GCP Batch.
Is there a way to exclude all GCP Batch VMs when running `gcloud compute config-ssh`?
Why would anyone want GCP Batch VMs included when using `gcloud compute config-ssh`?
Hi @nick-youngblut ,
Welcome to Google Cloud Community!
If apply a label solution to the instance that you want or don't want to be included on the command execution you could use something like
non_batch_machines=$(gcloud compute instances list --filter="-labels.batchsrv:yes" --format="value(name)")
gcloud compute config-ssh $non_batch_machines
Good Luck!
Thanks for the suggestion!
Your suggestion results in the following error:
WARNING: The following filter keys were not present in any resource : labels.batchsrv
ERROR: (gcloud.compute.config-ssh) unrecognized arguments:
Are there any docs specifically describing your solution? It is much more complex than just using a param in `gcloud compute config-ssh` to exclude GCP Batch jobs (e.g., `gcloud compute config-ssh --no-batch`).
More generally, why are GCP Batch jobs included by default?
My apologies, batchsrv:yes is a custom label and value that I did for this example, but it could be any label that you use to identify and differentiate your batch serves or non batch. Try it out with any set of labels present in your environment, or put the label batchsrv on your bat machines