I'm able to access a newly provisioned Google Computer instance running Ubuntu 16 via Google Cloud Web SSH interface, and also from other Google compute instances (even ones from different projects)

But when I try to ssh into the instance from my home computer, it gives a "Connection timed out"

I already checked UFW, it's set to allow 22/tcp.

The default ssh firewall ingress rule is also set : default-allow-ssh Ingress Apply to all
IP ranges: tcp:22 Allow

Not sure what the issue here is. My home network can access other GCE instances via SSH, and this particular GCE instance's web server is also accessible.

It seems specifically SSH connections from my home network is being blocked.


Which IP are you using?

You must use your instance external IP if you want to SSH from outside GCP. See GCP official documentation on how to connect to your instances (advanced methods).

Once you are able to reach your instance you might want to configure OS Login to make things easier for you.

“OS Login allows you to use Compute Engine IAM roles to manage SSH access to Linux instances and is an alternative to manually managing instance access by adding and removing SSH keys in metadata.”

See link [2] to configure OS Login

If the above recommendations do not work, please provide the output of the command ssh with -vvv to understand what is happening.

[1] https://cloud.google.com/compute/docs/instances/connecting-advanced#thirdpartytools

[2] https://cloud.google.com/compute/docs/instances/managing-instance-access

  • HI @ernesto, I'm using the external IP itself. It just seems the IP is not accessible itself from my home network (http, ssh, icmp ping nothing works). Here's the verbose output from ssh rajeev@rajeev-home-server:~$ ssh -v rajeev@xxx OpenSSH_7.2p2 Ubuntu-4ubuntu2.8, OpenSSL 1.0.2g 1 Mar 2016 debug1: Reading configuration data /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config line 19: Applying options for * debug1: Connecting to xxx port 22. debug1: connect to address xxx port 22: Connection timed out ssh: connect to host xxx port 22: Connection timed out – Rajeev Ravindran Jul 2 '19 at 16:59

Post was too long for a comment ...

I hoped the command gave us more clues :( . Without looking into your project FW rules and VM network tags is going to be difficult to narrow it down.

As you already mentioned that you have the proper firewall rules I can only think that you haven’t uploaded your SSH keys (from your home computer) into the instance

You can find clear instructions from Google documentation on how to generate these keys and uploaded in link [1]

Once you have done that the correct command to ssh is:



  • [PATH_TO_PRIVATE_KEY] is the path to your private SSH key file.
  • [USERNAME] is the name of the user connecting to the instance. The username for your public SSH key was specified when the SSH key was created. You can connect to the instance as that user if the instance has a valid public SSH key for that user and if you have the matching private SSH key.
  • [EXTERNAL_IP_ADDRESS] is the external IP address for your instance.

If that doesn't work you should try to contact GCP support, there might be certain things you don't see for example your project might be part of an organization and under a VPC perimeter that prevents the access from external networks [1]

[1] https://cloud.google.com/compute/docs/instances/adding-removing-ssh-keys

[2] https://cloud.google.com/vpc-service-controls/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.