2.5 Network Security

Key Takeaways

  • Security Groups are stateful virtual firewalls at the instance level — if inbound traffic is allowed, the response is automatically allowed.
  • Network ACLs (NACLs) are stateless firewalls at the subnet level — you must explicitly allow both inbound AND outbound traffic.
  • Security Groups only support Allow rules; NACLs support both Allow and Deny rules.
  • A VPC (Virtual Private Cloud) is an isolated virtual network within AWS where you deploy resources.
  • AWS PrivateLink enables private connectivity between VPCs and AWS services without exposing traffic to the public internet.
Last updated: March 2026

Network Security

Security Groups vs. Network ACLs

Understanding the difference between Security Groups and Network ACLs (NACLs) is critical for the exam. Both control network traffic, but they work differently.

Security Groups (Instance-Level Firewall)

Security Groups act as a virtual firewall at the instance level (specifically, at the network interface level).

FeatureDetail
LevelInstance (network interface)
StatefulYes — return traffic is automatically allowed
RulesAllow rules ONLY (no Deny rules)
DefaultDenies all inbound, allows all outbound
EvaluationAll rules evaluated before deciding
AssociationAttached to instances; an instance can have multiple security groups

Network ACLs (Subnet-Level Firewall)

Network ACLs act as a firewall at the subnet level. All traffic entering or leaving a subnet is evaluated against the NACL rules.

FeatureDetail
LevelSubnet
StatefulNo — stateless; you must define both inbound AND outbound rules
RulesBoth Allow AND Deny rules
DefaultAllows all inbound and outbound traffic
EvaluationRules evaluated in order by rule number (lowest first); first match wins
AssociationOne NACL per subnet; a NACL can be associated with multiple subnets

Head-to-Head Comparison

FeatureSecurity GroupNetwork ACL
Operates atInstance levelSubnet level
SupportsAllow rules onlyAllow AND Deny rules
Stateful?YesNo
Rule evaluationAll rules evaluatedRules evaluated in number order
Default behaviorDeny all inboundAllow all inbound and outbound

On the Exam: The most common question pattern is asking you to differentiate between Security Groups and NACLs. Remember: Security Groups = stateful + instance level + Allow only. NACLs = stateless + subnet level + Allow AND Deny.

VPC Fundamentals

A Virtual Private Cloud (VPC) is a logically isolated virtual network in AWS. Key components include:

ComponentDescription
SubnetsSubdivisions of a VPC within an AZ (public or private)
Route TablesRules that determine where network traffic is directed
Internet GatewayConnects the VPC to the internet (for public subnets)
NAT GatewayAllows private subnet resources to access the internet without being publicly accessible
VPC PeeringPrivate connection between two VPCs
VPC EndpointsPrivate connection from VPC to AWS services without using the internet

Public vs. Private Subnets

Subnet TypeInternet AccessUse Cases
PublicDirect access via Internet GatewayWeb servers, load balancers, bastion hosts
PrivateNo direct access (uses NAT Gateway for outbound)Databases, application servers, backend services

Encryption in Transit

Encryption in transit protects data as it moves between systems:

MethodDescription
SSL/TLSEncrypts web traffic (HTTPS) — used by most AWS services
VPNEncrypted tunnel between on-premises and AWS
AWS PrivateLinkPrivate connectivity to AWS services without internet exposure
AWS Direct Connect + MACsecEncrypted dedicated connection

AWS Network Security Services

ServicePurpose
AWS Network FirewallManaged network firewall for VPC traffic filtering
AWS PrivateLinkPrivate connectivity between VPCs and services
AWS Direct ConnectDedicated private network connection to AWS
AWS VPNEncrypted connection over the internet
AWS Transit GatewayConnect multiple VPCs and on-premises networks through a central hub
Test Your Knowledge

What is the key difference between Security Groups and Network ACLs?

A
B
C
D
Test Your Knowledge

A company wants to allow resources in a private subnet to access the internet for software updates, without making them publicly accessible. What should they use?

A
B
C
D
Test Your Knowledge

By default, a new Security Group:

A
B
C
D
Test Your Knowledge

Which statement about Security Groups is correct?

A
B
C
D
Test Your Knowledge

Which VPC component allows resources in a private subnet to access the internet for outbound traffic only?

A
B
C
D
Test Your Knowledge

A company needs to privately connect their VPC to Amazon S3 without traffic going over the internet. Which type of VPC Endpoint should they use?

A
B
C
D
Test Your Knowledge

What is the purpose of AWS PrivateLink?

A
B
C
D