Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error 4003: can't ssh login into the instance that I created in google cloud platform

I am using GCP and I created a vm instance, but I can't ssh into the machine. This is the error I am getting:

Connection via Cloud Identity-Aware Proxy Failed Code: 4003 Reason: failed to connect to backend

As I search it is because of This might mean the instance isn't listening on the port you're trying to connect to or the firewall is closed.

Here is my firewall config:

0.0.0.0/0 Deny All

like image 316
Ayush Verma Avatar asked Oct 18 '19 12:10

Ayush Verma


People also ask

Can't connect to SSH Google Cloud?

The firewall rule allowing SSH is missing or misconfigured. By default, Compute Engine VMs allow SSH access on port 22. If the default-allow-ssh rule is missing or misconfigured, you won't be able to connect to VMs. To resolve this issue, Check your firewall rules and re-add or reconfigure default-allow-ssh .

How do I enable SSH on Google Cloud?

In the Google Cloud console, go to the VM instances page. In the list of VMs, click the arrow_drop_down drop-down next to the SSH button of the VM that you want to connect to. Click Open in browser window using provided private SSH key. The SSH-in-browser window opens.


1 Answers

This may not be a complete answer, but at the very least your firewall rules aren't allowing connections on the SSH port. There should be an ingress rule to allow traffic to the instance on TCP port 22 (SSH) on that VPC network.

Generally, this is automatically created by GCP, on the default network it is typically called "default-allow-ssh", but you can also manually create it in the VPC Network -> Firewall rules tab. Make sure it applies to the instance in question (either through "All targets" or a target tag that matches the instance). You can read more about GCP firewall rules in the documentation.

Likewise, make sure you have an external IP or that you are following one of the options described here.

like image 181
robsiemb Avatar answered Oct 09 '22 18:10

robsiemb