JoshuaF
JoshuaF

Reputation: 1216

SSH hangs when attempting to connect to amazon AWS EC2 instance

Brand new to AWS. I was able to ssh to my EC2 instance fine yesterday, but today SSH hangs with this (verbose) output:

-> ssh -vvv -i "x.pem" [email protected]

OpenSSH_7.2p2 Ubuntu-4ubuntu2.4, 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 *
debug2: resolving "ec2-x-x-x-x.us-east-2.compute.amazonaws.com" port 22
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to ec2-x-x-x-x.us-east-2.compute.amazonaws.com [18.191.133.22] port 22.
debug1: Connection established.
debug1: key_load_public: No such file or directory
debug1: identity file x.pem type -1
debug1: key_load_public: No such file or directory
debug1: identity file x.pem-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.4

I tried the suggestions here SSH hangs when connecting to Amazon EC2 instance but none worked. I have a security rule allowing ssh to port 22 from anywhere.

I can ping the instance and telnet to port 22 fine.

Upvotes: 2

Views: 3871

Answers (4)

emilianolch
emilianolch

Reputation: 317

I had the same problem. I've been connecting by SSH without any problem for about a day. I also set up a VPN tunnel. Suddenly I couldn't log in anymore, SSH hanged at Local version string... and the VPN connection didn't work either.

I had to stop the instance and start it again.

Upvotes: 0

Patrick
Patrick

Reputation: 1111

The same thing happened to my instance, I could not ssh into it and my application running on it was unreachable. In the console the instance status was "Running". I am not sure what causes this, I eventually fixed it by just restarting the instance. It seems that ubuntu froze for some reasons.

Upvotes: 0

Dan Anderson
Dan Anderson

Reputation: 2345

I had to paste the contents of my public key, at ~/.ssh/id_rsa.pub , to Key Pairs under ymy EC2 Dashboard. Then I used this key when creating a new AWS instance (I blew away my old instance--maybe there is a way to change the keys).

Upvotes: 0

Prabuddha Chakraborty
Prabuddha Chakraborty

Reputation: 528

You may also look into the monitoring section of the ec2 instance for the CPU usage. If the CPU usage was 100% this may cause the problem. Since you are able to ssh now, check for the free disk space as well.

Upvotes: 6

Related Questions