Lab 22: The Security Group With Four Rules That Was Full
A web tier security group with four inbound rules refuses a fifth. The console shows four. The quota is sixty. The error names neither the rule that is in the way nor the number it is counting, and the change that filled the group was the one the review recommended.
- Debugging time
- ~20 min
- Reading time
- 15 min
- Reported by
- Web Platform
- Tier
- Associate
Cannot add an inbound rule to the web security group; API says the rule limit is reached but the group has four rules
Reported by Web Platform
I need to add one inbound rule to sg-web — HTTPS from a partner's address ranges, which we keep in
a prefix list. Terraform refuses it:
Error: creating VPC Security Group Ingress Rule: operation error EC2:
AuthorizeSecurityGroupIngress, https response error StatusCode: 400,
api error RulesPerSecurityGroupLimitExceeded: The maximum number of rules
per security group has been reached.The group has four inbound rules. I have counted them in the console and with
describe-security-group-rules. The quota for rules per security group is sixty, I checked Service
Quotas and we are on the default. Nothing is near any limit.
I tried a plain CIDR rule instead of the prefix list to see if it was something about prefix lists.
A /16 works. A rule referencing the corporate prefix list, which has three entries in it, is
refused with the same error. So I can add some rules and not others, to a group with four rules, and
the error says the group is full.
What you are working with
One VPC, one security group, two customer-managed prefix lists, one AWS-managed one. No instances.
Four inbound rules, drawn as the four things the console shows. Three of them are a CIDR each. The first references the AWS-managed CloudFront prefix list, and how much that one rule counts for is the entire lab. The two customer-managed lists are drawn at their maximum size rather than their current size, for a reason the Reproduction will make clear.
| Resource | Configuration |
|---|---|
| Security group | sg-web, four inbound rules, one outbound |
| Rule 1 | TCP 443 from the AWS-managed com.amazonaws.global.cloudfront.origin-facing prefix list |
| Rules 2–4 | TCP 443 from 10.52.0.0/16; TCP 22 from 10.50.8.0/24; ICMP echo from 10.50.0.0/16 |
| Corporate prefix list | 3 entries, max_entries 8, referenced by nothing |
| Partner prefix list | 3 entries, max_entries 200, referenced by nothing |
| Quota | Inbound rules per security group: 60 (default, unchanged) |
Nothing is deployed that bills by the hour. The failure is an API refusal, and it is observable with no running resources at all.
Scope and constraints
- In scope: why a group showing four rules refuses a fifth, and why some fifth rules are accepted while others are refused.
- Out of scope: the VPC, the quota value itself, and the contents of the prefix lists. All correct.
- The reporter is right that the group shows four rules and that the quota is sixty. Both are true, and the group is still full. Work out what "full" is measuring.
- The reporter's experiment — a
/16is accepted, a three-entry prefix list is refused — is the most useful observation in the ticket. It tells you the unit being counted is not "rules". - The fix is a sizing decision, and there are two places to make it.
Deploy the broken state
cd lab-22-security-group-prefix-list-quota
terraform init
terraform applyUnder a minute. There are no instances to wait for.
The rest of this lab is part of Labs Pro
The reproduction steps, the deployable Terraform, and the debrief with root cause and remediation diff for this lab are available to Labs Pro members. One payment of $49, no subscription, and it covers every Pro lab now and later.
The incident brief is open, so you can see what you would be solving before you decide.
Already bought it? Sign in and it unlocks.
The rest of this lab is part of Labs Pro
The reproduction steps, the deployable Terraform, and the debrief with root cause and remediation diff for this lab are available to Labs Pro members. One payment of $49, no subscription, and it covers every Pro lab now and later.
The incident brief is open, so you can see what you would be solving before you decide.
Already bought it? Sign in and it unlocks.