- Newest
- Most votes
- Most comments
When you create a security group rule that specifies a managed VPC prefix list as the source or destination, the maximum number of entries configured for the prefix list will be used as a multiplier to determine the rule capacity consumed from the inbound or outbound rule capacity of the security group.
When a security group rule is added to security group X, specifying security group Y as the source or destination, this rule in group X will always count as exactly one rule. It doesn't matter if group Y contains rules that reference prefix lists; they won't be counted. That's because the rule being added to group X doesn't permit access from/to the CIDRs on the prefix lists used in the rules of group Y; instead, access will be permitted from/to the elastic network interfaces (ENIs) to which group Y is attached.
In practice, this means you can't work around the limit of rules per security group by "nesting" group Y's rules in group X. Referencing group Y from a rule in group X will only allow access from/to the "members" of group Y, not from the IP CIDRs that group Y allows access from/to.
However, you can attach up to 5 security groups (the default quota) to each ENI. If you need 100 rules per direction, for example, you could put 50 of them in security group A and the other 50 in group B, and attach both the groups A and B to the ENI of your server or other resource to have up to 120 rules per direction available.
Your approach to reference the prefix list in a separate security group (SG-PL) and then reference this SG-PL in other security groups is a clever workaround to the quota limitations you're facing. This strategy can indeed help you manage the number of entries more efficiently.
When you reference another security group in a security group rule, it counts as only one rule, regardless of the size or complexity of the referenced security group. This means that even if your SG-PL contains a rule referencing a large prefix list, when you reference SG-PL in other security groups, it will only count as one rule in those security groups.
However, it's important to note that the SG-PL itself will still be subject to the quota limitations. The rule in SG-PL that references the prefix list will count towards its quota based on the size of the prefix list. For a customer-managed prefix list, this would be the maximum size of the prefix list. For an AWS-managed prefix list, it would be the weight of that prefix list.
So, while this approach won't reduce the impact on SG-PL itself, it will allow you to effectively "compress" the impact of the prefix list when referenced in other security groups. This can help you stay within the quota limits for those other security groups.
Remember that you should still monitor the size of your prefix list and the quotas of your security groups. If the prefix list continues to grow, you may eventually need to consider other solutions, such as splitting the prefix list or requesting quota increases from AWS.
Sources
Security group rules - Amazon Virtual Private Cloud
AWS-managed prefix lists - Amazon Virtual Private Cloud
answered 2 years ago
Relevant content
asked 3 years ago

the question is will this make the entries of the managed prefix list considered as rules in the inbound security group that reference the SG-PL security group that reference the managed prefix list? thanks for your care?