I am trying to automate creation of VMs in GCE.
I want to ssh into my VM and execute a command directly through the gcloud console.
> gcloud compute ssh <instance>
will open a new ssh window, instead of that, I want to execute the shell command inside VM directly from gcloud console without redirecting to a new ssh window.
Thanks in advance
You can use the --command
flag for that:
gcloud compute ssh <instance> --command <command>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With