How to solve gcloud cli "4047: 'Failed to lookup instance'" error
04:24 29 Jun 2022

Today, out of the blue, a long time working script give this error on one server:

# gcloud compute ssh root@my-server --command=/bin/ls --tunnel-through-iap --zone=my-zone

ERROR: (gcloud.compute.start-iap-tunnel) Error while connecting [4047: 'Failed to lookup instance']. ssh_exchange_identification: Connection closed by remote host

Recommendation: To check for possible causes of SSH connectivity issues and get recommendations, rerun the ssh command with the --troubleshoot option.

gcloud compute ssh my-server --project=my-project --zone=my-zone --troubleshoot

Or, to investigate an IAP tunneling issue:

gcloud compute ssh my-server --project=my-project --zone=my-zone --troubleshoot --tunnel-through-iap

On other servers command work fine! On the problematic server no updates was done.

ssh gcloud