8

I created my first EC2 instance (linux) using Amazon Web Services, but I can't connect on any port from any host. I changed the inbound rules on my security groups to allow connections from any ip 0.0.0.0/0 and any protocol. But when I telnet on port 22 or port 80 or any other port, the network connection times out with no connection.

What else do I need to configure to connect to my EC2 instance from the internet beside the security group inbound rules?

  • 1
    This is a real PITA . Thanks for asking: but the answer does not make things more "comfortable". – javadba Feb 26 at 0:34
8

Apparently all new EC2 instances are created inside a Virtual Private Cloud at Amazon. This means traffic is not routed from the internet to the EC2 host until a few more things are set up. The things to check are:

  • subnet association to the vpc
  • existence of an internet gateway on the vpc
  • association of the subnet to a routing table
  • a new rule in the routing table which routes traffic from the internet to the EC2 host and back

Here is a diagram of this most basic setup from this article at AWS knowledge base support.

enter image description here

I followed this article doing the steps I listed in the bullet list above, and now I can connect on ssh and any other port allowed in the inbound rules for my EC2 host's security group.

  • This is a crazy amount of work for e.g. an ephemeral ec2 instance for a specific task that won't be renewed. Is there really not a shortcut for all this? – javadba Feb 26 at 0:35
  • @javadba there is a shortcut for large scale, and it's called scripting. But unfortunately there is no "quick start" option for one-off newbies. – steampowered Aug 16 at 15:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.