简体   繁体   中英

SSH disconnecting and not wanting to reconnect to Amazon EC2 instance (Macbook)

I have tried multiple instances, have spent all day going through different ways to fix this, but each time I connect via ssh from my macbook to one of my amazon EC2 instances they only work once.

I can usually connect, using the standard ssh -i "FILENAME.pem" ubuntu@ec2-54-174-127-125.compute-1.amazonaws.com

Then, the instance will freeze (usually after 5-20 minutes) and when I try to connect afterwards it will not be responsive and I will get ssh: connect to host ec2-54-174-127-125.compute-1.amazonaws.com port 22: Operation timed out

I have tried modifying my ssh config file, as many internet answers suggest, but it did not help the slightest. I also had the same problem in an Ubuntu VM.

Here is the modified config:

Host *
    SendEnv LANG LC_*
    ServerAliveInterval 120

I looked at my security groups and did everything that the Amazon guidelines recommend.

Here is a screenshot of the full output:

OpenSSH_7.3p1, LibreSSL 2.4.1
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 20: Applying options for *
debug1: /etc/ssh/ssh_config line 57: Applying options for *
debug2: resolving "ec2-54-89-219-10.compute-1.amazonaws.com" port 22
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to ec2-54-89-219-10.compute-1.amazonaws.com    [54.89.219.10] port 22.
debug1: connect to address 54.89.219.10 port 22: Operation timed out
ssh: connect to host ec2-54-89-219-10.compute-1.amazonaws.com port 22:   Operation timed out

Can you please help?

Thanks,

Tim

Turns out, this was caused by my account being in "Isolation".

This was AWS's reponse:

"I checked your instances, and from the configuration stand point it looks good. Further checks showed your AWS account was in isolation, which prevented you from accessing your instances via SSH. The isolation has been removed, please start up your EC2 instances and try connecting again. Please let me know how it goes."

I have no idea how I could have known this about my own account. If someone else gets this situation, it might be worth paying for the pro support for them to answer your question (after you've tried everything).

You can switch to a plan with support (Developer Plan) and pay pro-rated if you cancel. It cost me ~3$ for 1 day of pro support, and saved me countless hours

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM