Currently, if I want to execute something on a VM, I copy files over like this:
gcloud compute --project <project_id> copy-files --zone <zone_name> /home/roman/source/dir roman@<vm_name>:/some/path
Then I need to SSH into it manually like this:
gcloud compute --project <project_id> ssh --zone <zone_name> <vm_name>
And then go and run some command:
cd /some/path
python example.py
How do I combine step 2 and 3 together and execute a command remotely?
Note: I want to use gcloud or the python api. I don't want to use 3rd party packages like Fabric.