As we know security groups are statefull in AWS Cloud. while launching ec2 instances when we allow inbound rules for specific port it must allow that specific traffic at outbound instead it will allowing all tarffic why is this so?
launched ec2 instance in inbound I allowed ssh at port 22 and http at port 80 https at port 443 in outbound it automatically allowed all traffic instead of these three protocol
A security group controls the traffic that is allowed to reach and leave your EC2 instance. Did you use default SG? By default, SG Allows all outbound IPv4 and IPv6 traffic.
So if you need, you could manually deny all outbound traffic and allow only 80 443 and 22 ports.