mDe
mDe

Reputation: 107

GCP- SSH connection timed out

I've been using ssh to connect to my Google Cloud Compute instance and it's been working fine. However, I left some code running on my instance and shut down my laptop. After turning it back on, I saw that the connection was disconnected with a port 22: Broken pipe error. Since then, I haven't been able to ssh into my instance. I get this error each time- ssh: connect to host <IP> port 22: Operation timed out

I'm new to SSH (just a data scientist trying to train some models on GCP..) and not sure how to proceed. Would appreciate any pointers. Thanks!

Upvotes: 2

Views: 12437

Answers (2)

Meynoush
Meynoush

Reputation: 1

It can be an SSH problem.

You may want to go to your gcloud console, choose your machine.

From the vm instances panel, select "observability".

From the internal side panel, go to Logs> All logs. Change the RESET ZOOM according the the date that you believe the connection could be disconnected from now on.

Set the Log severity to "Error".

From here you can see what went wrong. If you found it says: "Invalid ssh key entry - expired key". It means that your ssh got expired and you have to trouble shoot for "ssh expired key".

You may also want to try to check if your ssh from your gcloud doesn't have any issues. To do so From the vm instaces panel, find a the dropdown SSH button. Select Open in browser window. If you could connect to your machine from that window, you may want to continue with the previous step.

You would also like to copy the "gcloud command line: from the same dropdown button and try to run it locally.

Some other obvious things that can slip our mind:

Check if your instance is on. Check if it's got an IP from your network. Check if you have the internet connection. Ping your external IP address if you are using one.

Upvotes: 0

ABO Baloyi
ABO Baloyi

Reputation: 17

ssh /authorized_keys using command ls -la
if you have run this ssh -i [PATH_TO_PRIVATE_KEY] [USERNAME]@[EXTERNAL_IP_ADDRESS] if not configure keygen to have private key

Upvotes: 2

Related Questions