`terraform apply` fails with `RulesPerSecurityGroupLimitExceeded: The maximum number of rules per security group has been reached`.
BeginnerTroubleshootingCloud networking: VPC, firewalls, NAT, VPN and proxies
Answer
Likely causes → An SG has a default quota of 60 inbound and 60 outbound rules (each CIDR counts as a rule). Allow-listing many partner IPs or CDN ranges one by one hits it quickly.
Diagnose →
aws ec2 describe-security-groups --group-ids <sg> --query 'length(SecurityGroups[0].IpPermissions[].IpRanges[])'
aws service-quotas get-service-quota --service-code vpc --quota-code L-0EA8095F
Fix → Use managed prefix lists (one reference counts as rules equal to its max entries, but is much easier to manage), AWS-managed prefix lists (e.g. CloudFront origin-facing), split rules across SGs, or request a quota increase (rules × SGs per ENI is capped at 1000).
Prevent → Reference SGs and prefix lists instead of raw CIDRs; review rules that grow from ad-hoc requests.
More on Cloud networking: VPC, firewalls, NAT, VPN and proxies
An EC2 instance in a private subnet hangs on `apt-get update` at `Connecting to archive.ubuntu.com`.BeginnerA new EC2 instance in a "public" subnet can't be reached over SSH from the internet; the SG allows port 22 from your IP.BeginnerThe SG allows inbound 443 and the app works from inside the VPC, but internet clients time out. The subnet NACL allows inbound 443.IntermediateA VPC peering connection is `Active`, but instances in the two VPCs can't ping each other.BeginnerALB targets are `unhealthy` with reason `Target.Timeout`, and VPC Flow Logs show `REJECT` from the ALB's IPs to the instances.BeginnerTwo VPCs are attached to a Transit Gateway, but traffic between them fails.Intermediate