1

I created EC2 Ubuntu Instance, when the status check was clear, I tried following command.

chmod -400 key.pem

&

ssh -i key.pem ubuntu@ip_address

which gave following error

ssh: connect to host ip_address port 22: Connection refused

Then I tried rebooting the Instance but the error was still there.I tried

telnet ip_address 22

which gave me the same error

telnet: Unable to connect to remote host: Connection refused

I already follwed this and this following links but none worked:

Please tell me how do I resolve this.

1 Answers1

0

For EC2, first check your network security groups. Normally outbound is open, but inbound is completely closed. Did you set up port 22 and set it either to your IP address or open?

Also, check what happens when you type sudo service ssh restart. No error message is usually good.

Do you have more than one instance? Can you ssh from one to the other?

Also, make sure you are using the public IP address

brianlmerritt
  • 163
  • 2
  • 7
  • My inbound is open on port 22 and 80 and outbound open for all. My inbound source is anywhere. My `ssh` works fine and no error on restarting. –  Dec 18 '15 at 07:35
  • Cool - it will cost only cents to create another instance and troubleshoot by ssh between them and also did you try everything on https://www.youtube.com/watch?v=_P29ZHu_feU ? – brianlmerritt Dec 18 '15 at 10:05
  • What do you do if there is an error on restarting? I got `Unit ssh.service not found` on my ubuntu PC – riders994 Jun 20 '17 at 18:28
  • Not sure what that has to do with AWS – brianlmerritt Jun 21 '17 at 18:23