Cannot connect to AWS E2 instance (but security group allows inbound)

Viewed 796

I am new to AWS and launched my first EC2 instance (Amazon Linux), got a public IPv4 address for it.

The SSH port is closed and the instance does not respond to ping. It looks as if it was totally disconnected from the internet.

All the help I found online was related to security groups and opening the proper ports (or ICMP) but I already did this, in fact I even set the corresponding security group to allow all inbound traffic.

The instance shows Online and reachabiliy check shows ok. The route table of the subnet directs 0.0.0.0/0 to the igw.

What else could this be??? There must be something else that I am forgetting.

Thanks!

EDIT: (this is still not resolved, the suggestions below, although good, did not help)

Screenshots of everything: https://florianbador.com/pub/aws-issue-screenshots/

EDIT 2:

I found what the problem is (or at last the real symptoms). The machine is available through the network for about 1 minute after its creation then it is like offline (although still on).

I tested twice with 2 other machines and the same thing happened: for 1 minute I could log via ssh, then the terminal froze as if someone put an iptables DROP rule there, and I could never reach the server again. I tried from different IP addresses, it doesn't seem to be that something blacklists my IP, it's the whole server that becomes unreachable, from anywhere.

Any idea what this could be?

EDIT 3:

As a confirmation of Amit's answer below, here's a screenshot showing that indeed Amazon blocks accounts even when they have been reactivated, and there is no way to tell that an account is somehow blocked on their network because everything shows as normal in the portal.

I decided not to use AWS because I cannot risk to put 20 businesses in jeopardy, risking to see them all down one day for some administrative reasons that take days to debug/understand. Amazon confirming they secretly block accounts on the network without this being visible in the portal

1 Answers

I faced a very similar issue and I finally figure it out.

Security Groups for Your VPC :

A security group acts as a virtual firewall for your instance to control inbound and outbound traffic.

therefore, even though the security group allowed inbound and outbound traffic, you need to make sure the VPC is public or VPC private that use NAT gateway.

VPC with Public and Private Subnets :

The instances in the public subnet can send outbound traffic directly to the Internet, whereas the instances in the private subnet can't. Instead, the instances in the private subnet can access the Internet by using a network address translation (NAT) gateway that resides in the public subnet. The database servers can connect to the Internet for software updates using the NAT gateway, but the Internet cannot establish connections to the database servers.

Update:

As mentioned in the comments, looks like the problem is with the aws account. after the account is closed\suspended the account being blocked to connect any resource. even after reactivated the account, the account still doesn't have access to new instances and you need to connect with aws.

This information based on this thread and @FlorianB experience.

Related