Initially ran the below command in terminal.
gcloud compute ssh --project="pret-registry" --zone="us-east1-b"
"pretlist-hw-server" --tunnel-through-iap --dry-run
Output of the above command
ssh -t -i C:\Users\Administrator.ssh\google_compute_engine -o
CheckHostIP=no -o HashKnownHosts=no -o
HostKeyAlias=compute.1900385377936815063 -o IdentitiesOnly=yes -o
StrictHostKeyChecking=no -o
UserKnownHostsFile=C:\Users\Administrator.ssh\google_compute_known_hosts
-o "ProxyCommand C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\bundledpython\python.exe -S "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\gcloud.py" compute start-iap-tunnel pretlist-hw-server %p --listen-on-stdin --project=pret-registry
--zone=us-east1-b --verbosity=warning" [email protected]
Tried running the above command in my terminal and got the below error.
C:\Program Files (x86)\Google\Cloud
SDK\google-cloud-sdk\platform\bundledpython\python.exe: can't open
file 'C:\Program': [Errno 2] No such file or directory
kex_exchange_identification: Connection closed by remote host
If I navigate to C:\Program Files (x86)\Google\Cloud SDK in my terminal and run the below command (replaced the aforementioned path with "."), then the connection goes through.
ssh -t -i C:\Users\Administrator.ssh\google_compute_engine -o
CheckHostIP=no -o HashKnownHosts=no -o
HostKeyAlias=compute.1900385377936815063 -o IdentitiesOnly=yes -o
StrictHostKeyChecking=no -o
UserKnownHostsFile=C:\Users\Administrator.ssh\google_compute_known_hosts
-o "ProxyCommand .\google-cloud-sdk\platform\bundledpython\python.exe -S ".\google-cloud-sdk\lib\gcloud.py" compute start-iap-tunnel pretlist-hw-server %p --listen-on-stdin --project=pret-registry
--zone=us-east1-b --verbosity=warning" [email protected]
Need this ssh to work with full path since I want to connect to gcp from vs code.