1.2 Design secure workloads and applications.
1.What is the key difference between a security group and a network ACL (NACL)?
- A.Security groups operate at the subnet level, while NACLs operate at the instance level.
- B.Security groups are stateless, while NACLs are stateful.
- C.Security groups are stateful, while NACLs are stateless.
- D.Security groups support allow and deny rules, while NACLs only support allow rules.
Show answer & explanation
Correct answer: C — Security groups are stateful, while NACLs are stateless.
- A. Incorrect. This statement reverses the operational levels. Security groups act as a firewall for associated EC2 instances and operate at the instance (or more specifically, the Elastic Network Interface - ENI) level. Network ACLs (NACLs) act as a firewall for a subnet, controlling traffic in and out of one or more subnets.
- B. Incorrect. This statement reverses the statefulness of the two components. Security groups are stateful, and NACLs are stateless.
- C. Correct. This is a fundamental difference. Security groups are stateful, meaning if you allow inbound traffic on a certain port, the corresponding outbound return traffic is automatically allowed, regardless of any outbound rules. Network ACLs are stateless, meaning you must explicitly define rules for both inbound and outbound traffic; return traffic must be explicitly allowed by an outbound rule.
- D. Incorrect. This statement reverses the rule types. Security groups only support 'allow' rules. By default, all traffic is denied, and you cannot create explicit 'deny' rules. In contrast, Network ACLs support both 'allow' and 'deny' rules, which are evaluated in numerical order.