I would like to be able to execute terminal commands on a GCP compute engine instance using the GCP API. Is this possible?
Ideally I would like to do the following: (1) start a compute engine instance, (2) run an executable on that instance, (3) wait for the executable to complete, and then (4) shut the instance down. I know how to do 1, 3, and 4, but 2 is missing. I can do that by SSH'ing into the instance and running ./path_to_executable but would like to do so programmatically.
I have tried setting the machine's startup script as the path to that executable but that does not seem to work. Is there any other way to accomplish this?