When I try to connect to ec2 through my pem file it worked fine. Once I connected to ec2 and exited from terminal, from next time it's giving error
ssh_exchange_identification: Connection closed by remote host
When I again tried to connect, I got the following error
ssh_exchange_identification: read: Connection reset by peer
I have rebooted the instance and now I am getting the following error
ssh: connect to host MY-IP port 22: Operation timed out
I have seen so many solutions. Most of them messed up with security groups. But I have correct security group.
INBOUND ssh 22 0.0.0.0/0
OUTBOUND All Trafic All All 0.0.0.0/0
Even then I am getting the same error.
I have tried ssh -v -i XXX.pem [email protected]
ouput is
OpenSSH_7.6p1, LibreSSL 2.6.2 debug1: Reading configuration data /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config line 48: Applying options for * debug1: /etc/ssh/ssh_config line 52: Applying options for * debug1: Connecting to my_ip port 22. ssh: connect to host my_ip port 22: Operation timed out
ssh -i xx.pem [email protected]
.