I know it is possible to execute commands remotely using ssh (in a file) like so;
#!/bin/sh
ssh ${USER}@${SERVER_IP} <<EOF
cd ${PROJECT_PATH}
git pull
exit
EOF
my question is this: it possible to do the same with gcloud compute ssh? I mean;
gcloud compute ssh vm-internal --zone us-central1-c --tunnel-through-iap << EOF
...
...
EOF
PS: The instance is private with no external IP hence the use of iap
As long as you can ssh onto the instance, you should be able to:
You can test this (thanks to
gcloud
consistency using Cloud Shell):Yields: