Difference between Security Groups and Network ACLs

0 101

  1. Scope: Where to apply (Subnet or EC2 Instance)
    Security groups are tied to an instance whereas Network ACLs are tied to the subnet. i.e. Network Access control lists are applicable at the subnet level, so any instance in the subnet with an associated NACL will follow rules of NACL. That’s not the case with security groups, security groups has to be assigned explicitly to the instance. This means any instances within the subnet group gets the rule applied. If you have many instances, managing the firewalls using Network ACL can be very useful. Otherwise, with Security group, you have to manually assign a security group to the instances.
  2. State: Stateful vs Stateless
    Security groups are stateful: This means any changes applied to an incoming rule will be automatically applied to the outgoing rule. e.g. If you allow an incoming port 80, the outgoing port 80 will be automatically opened.
    Network ACLs are stateless: This means any changes applied to an incoming rule will not be applied to the outgoing rule. e.g. If you allow an incoming port 80, you would also need to apply the rule for outgoing traffic.
  3. Allow or Deny rules
    Security group support allow rules only (by default all rules are denied). e.g. You cannot deny a certain IP address from establishing a connection.
    Network ACL support allow and deny rules. By deny rules, you could explicitly deny a certain IP address to establish a connection example: Block IP address 123.201.57.39 from establishing a connection to an EC2 Instance.
  4. Rule process order
    All rules in a security group are applied whereas rules are applied in their order (the rule with the lower number gets processed first) in Network ACL.
    i.e. Security groups evaluate all the rules in them before allowing a traffic whereas NACLs do it in the number order, from top to bottom.
    Defense order
    Security group first layer of defense, whereas Network ACL is second layer of the defense.

Leave A Reply

Your email address will not be published.