amazon-web-servicesnetwork-security-groups

AWS Security Group rules: How does ssh connection to EC2 still works when I have removed outbound rules


Here is my security group, inbound and outbound rules for the EC2 instance in AWS.

Security Group Rules

My understanding was that if I block every outbound traffic i will not be able to able to ssh into the system even if the inbound connection is allowed.

I did go through many documentation on it and did not really understand how the system is sending back data to ssh connection when the outbound rules are not allowing it.

Does this mean, a web server will still work without any outbound rules, provided ports for inbound, let's say 80, 443 are opened ?


Solution

  • The SSH connection is still working because security groups are stateful which means that if a connection/traffic can get inside, it can go outside. NACLs on the other hand are stateless which means that the challenge/test happens on entry and exit of traffic.