Anshu Dutta
Anshu Dutta

Reputation: 491

Unable to ssh to ec2 instance in VPC

Connection gets timed out when I try to ssh into the ec2 instance and I have isolated the toot cause to the Network ACL associated with the subnet. Below is what I have for inbound and outbound rules. When I change the network ACL to the vpc default which has all ports open for inbound and outbound connection, I can ssh to the box. Whats wrong with this one? I have opened port 22.

enter image description here

enter image description here

Upvotes: 0

Views: 964

Answers (1)

Olli
Olli

Reputation: 679

From AWS documentation:

Network ACLs are stateless; responses to allowed inbound traffic are subject to the rules for outbound traffic (and vice versa).

You need to relax egress ACL to allow outbound connections from ephemeral ports. For example, allow outbound TCP connections for a range of 1024-65535.

For more information, see the Wikipedia article on ephemeral ports.

Upvotes: 2

Related Questions