What are the nuances of security group statefulness?
AdvancedConceptVPC and Networking
Answer
Security groups track connections, so return traffic is allowed automatically. Two surprises: if a SG rule is removed, already-tracked connections continue until they idle out or close; and if a rule allows 0.0.0.0/0 on all ports for both directions, the connection is untracked, so removing the rule does take effect immediately.
Also, tracking has idle timeouts (350 seconds for established TCP by default), which affects long-idle connections through NLB or firewalls and is fixed with TCP keepalives.
More on VPC and Networking
What is a VPC and what are the CIDR constraints?BeginnerWhat makes a subnet public or private?BeginnerHow do route tables work, including the local route and longest-prefix match?IntermediateInternet Gateway vs NAT Gateway: what does each do?BeginnerNAT Gateway vs NAT instance?IntermediateSecurity group vs network ACL: compare them.Beginner