VPC security group rule limits.

10/09/2023

Amazon Virtual Private Cloud (Amazon VPC) security groups are essentially virtual firewalls that control inbound and outbound traffic to your AWS resources, such as EC2 instances. Each security group can have multiple rules, and there are some limits you should be aware of:

  1. Number of Rules per Security Group:
    • By default, each security group can have up to 60 inbound and 60 outbound rules. This limit applies to both EC2-Classic and EC2-VPC.
  2. Number of Security Groups per Network Interface:
    • Each network interface can be associated with up to 5 security groups.
  3. Number of Rules per Network Interface:
    • Each network interface can have up to 60 inbound and 60 outbound rules.
  4. Number of Security Groups per EC2 Instance:
    • An EC2 instance can be associated with up to 5 security groups.
  5. Number of Rules per EC2 Instance:
    • Each EC2 instance can have up to 250 inbound and 250 outbound rules.
  6. Combining Inbound and Outbound Rules:
    • The total number of rules (inbound + outbound) for a single security group cannot exceed 120.
  7. VPC Security Group Limits:
    • Each VPC has a soft limit of 500 security groups per VPC. You can request an increase in this limit from AWS Support.
  8. Egress Only Internet Gateways (Egress-Only VPC Internet Gateways):
    • You can associate up to 60 security groups with an Egress Only Internet Gateway.
  9. Prefix List References:
    • Each security group rule can reference up to 60 AWS service prefix lists.
  10. Security Group Rule References:
    • A security group rule can reference another security group by ID.
  11. Security Group Rule Sizes:
    • The size of the rules in a security group cannot exceed 60 KB.

It's important to plan your security groups carefully to ensure that they meet your specific requirements while staying within these limits. If you find that you need more rules, you may need to re-evaluate your architecture or request a limit increase from AWS Support.

Always consider the principle of least privilege when setting up security group rules, and regularly review and update your security group configurations as your application evolves.

Comments

No posts found

Write a review