I have a Python script on a gcloud VM instance. I want to run it via this shell script:
gcloud compute instances start instance-1 #start instance
gcloud compute ssh my_username@instance-1 #ssh into it
cd project_folder #execute command once inside VM
python my_script.py #run python script
sudo shutdown now #exit instance
gcloud compute instances stop instance-1 #stop instance
The first two commands work as intended; however, the rest of the commands don't execute on the VM. How can I make a script that executes commands after connecting to the VM?