I've set up an EC2 instance, and don't seem to be able to ssh into it.

Searching around and looking for general solutions to this, I've set it up with the following characteristics

  • I have used a subnet to which contains an internet gateway, and an --> IGW rule
  • Security group has a rule that allows ssh inbound, and All, All, outbound
  • EC2 has a public DNS and an elastic and Public IP - don't think I need both here, as public ip is sufficient, but I don't think providing an elastic ip does any harm
  • Subnet Network ACL has a rule specifically for ssh inbound, and TCP on port 49152-65535 outbound.
  • the AZ of the subnet matches that of the EC2 instance.

I think it's a network problem rather than anything to do with ssh keys at this stage, as when I run ssh -v to try connect to the machine, I don't even see it succeeding to get to the first part of the handshake.

Any thoughts on what steps I've missed!

  • What does ssh say? Timeout? Something else? Ideally update your question with the actual output of the ssh command.
    – MLu
    Mar 29, 2020 at 11:41
  • update: I since made an instance that does seem to work, so now I can track backwards and work out what I did differently. Will update the question when I figure it out. Specifically on @MLu question - SSH was timing out...
    – phatmanace
    Mar 29, 2020 at 13:00

1 Answer 1


First check your instance is answering to traffic from 22 port. https://ping.eu/port-chk/

Then please check if your terminal is capable of SSH. for example:

ssh -T [email protected]

Now if this works, try your credentials on your instance.

On AWS I would suggest:

  • Make sure instance is running.
  • Security group attached has the rule: inbound: TCP PORT 22 from
  • User name for SSH is usually set inside the image (AMI) e.g ec2-user for Amazon linux and ubuntu for Ubuntu LTS and so on.. so try look at the details panel for your instance.
  • Make sure the VPC is connected to the internet. then make sure this VPC is associated to the subnet that your instance is on.
  • Thanks, but I don't think it's a terminal problem, and as I can't even connect to the instance, I don't think its a user or key problem either.
    – phatmanace
    Mar 29, 2020 at 9:42
  • Please run all what said above, and update your question with the results. we cannot assist, if we do not have the information.
    – JonnieJS
    Mar 29, 2020 at 9:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .