Remis Haroon - رامز
Remis Haroon - رامز

Reputation: 3572

Google Compute Engine: execute a shell command inside vm directly from gcloud console

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

Upvotes: 5

Views: 3046

Answers (1)

Andreas Veithen
Andreas Veithen

Reputation: 9154

You can use the --command flag for that:

gcloud compute ssh <instance> --command <command>

Upvotes: 9

Related Questions