Unable to open ssh of vm instance on GCP : cannot connect to backend (code : 4003)

Viewed 442

There was recommendation for machine specification modification and so I Reduced the specification of instance. After that When I am opening SSH of VM instance on GCP it gives me an error as shown in image enter image description here

After that tried recommendation and clicked on connect without identity-aware proxy then following error occured enter image description here

Although I have allowed default-allow-ssh on port 22 for ingress as it comes by-defualt by gcp.

Also tried some other solutions as previously mentioned of using custom metadata with key 'startp-script' and value as a bash command but that did not work .

What is missing? I have other instances too but i can access ssh of them. There is only 1 instance that is not being accessed.

1 Answers

According to Google Cloud FAQ:

Error Code 4003
This might mean the instance isn't listening on the port you're trying to connect to or the firewall is closed. Either of those issues could also cause the start-up connectivity test to the VM instance to fail.

Check if your firewall rules allow SSH connection, you should look for default-allow-ssh.

You can also enable serial connection to your virtual machine:

gcloud compute instances add-metadata instance-name \ --metadata serial-port-enable=TRUE

Connect to the machine:

gcloud compute connect-to-serial-port instance-name

and check status of ssh service:

sudo systemctl status sshd.service

If these steps do not resolve your issue, you can follow this guide: Troubleshooting SSH
I had the same problem couple of times, but they resolved themselves after couple of minutes.

Related