Instiq
Chapter 3 · Infrastructure Security·v2.0.0·Updated 7/17/2026·~11 min

What's changed: Deepened SCS-C02 Chapter 3 (added comparison tables, scenarios, FAQs, exam traps, deep-dive paragraphs to each section; localized figures to Japanese)

3.1Protecting the Network Perimeter

Key points

Understand VPC security—security groups/NACLs, subnet isolation, NAT/IGW, VPC endpoints (Gateway/Interface), and PrivateLink. Defend networks in depth.

Network perimeter is the basis of infrastructure defense. Defend in layers (SG/NACL/subnet) and avoid unnecessary exposure.

3.1.1Layered network defense

Diagram of VPC network security: subnets split public/private; layered defense with security groups (per-instance, stateful, allow-only) and NACLs (per-subnet, stateless, allow/deny); private-subnet egress via a NAT gateway; and access to AWS services without the internet via VPC endpoints (S3/DynamoDB = gateway type, others = interface type/PrivateLink).
Layered network defense
  • Security groups: per-instance, stateful, allow-only (no deny rules).
  • NACL: per-subnet, stateless, allow/deny; can explicitly deny.
  • Subnet isolation/NAT: public for exposed, private for internal; egress-only via a NAT gateway.
  • VPC endpoints: reach AWS services without the internet (S3/DDB = gateway, others = interface/PrivateLink).
Exam point

Common on SCS-C02: per-instance, stateful, allow-only = security groups, per-subnet, stateless, can-deny = NACL, egress-only = NAT gateway, private access to AWS services = VPC endpoints (S3/DDB = gateway type). Use NACLs to explicitly deny IPs; SGs for normal allow.

Note

Security groups auto-allow return traffic (stateful). NACLs are stateless, so you must also allow ephemeral ports for return traffic.

SCS-C02 network defense probes "precisely distinguishing SG vs NACL and shrinking attack surface in layers." A security group (SG) is a stateful virtual firewall per instance (ENI), allow-only (implicit deny; no explicit deny). You can set another SG as the source (e.g., allow the web tier only from the ALB’s SG), cleanly expressing inter-tier communication. A NACL is stateless control per subnet evaluating allow and deny in number order—needed for blocking specific IPs or allowing ephemeral ports for return traffic. Split subnets into public (exposed via IGW) / private (egress via NAT, internal only), placing the data tier in internet-unreachable private subnets. Reach AWS services via VPC endpoints without the internet, distinguishing gateway type (S3/DynamoDB, free, route table) from interface type (ENI, PrivateLink, many services), and restrict access with endpoint policies. Further connect via VPC peering/Transit Gateway, and visualize traffic with flow logs. The key is to not confuse "stateful, allow-only, per-instance = SG / stateless, can-deny, per-subnet = NACL," and to defend in depth with private connectivity and minimal exposure.

AspectSecurity groupNACL
ScopePer instance (ENI)Per subnet
StateStateful (auto-allow return)Stateless (explicit return)
RulesAllow-onlyAllow/deny (numbered)
Typical useInter-tier allow; SG as sourceExplicitly deny specific IPs
Note

Scenario: In a 3-tier (web/app/DB) setup, allow web only from the ALB, app only from web, DB only from app, and fully block a specific attacker IP range. → Set each tier’s SG source to the upstream SG for least-privilege inter-tier access (the DB SG allows only the DB port from the app SG). Put the DB in an internet-unreachable private subnet. Block the attacker IP range with an explicit deny in the subnet NACL (SGs cannot deny). Reach AWS services via VPC endpoints.

Note

FAQ: SG or NACL to block a specific IP? NACL. SGs are allow-only and cannot explicitly deny (deny = not allowing). To explicitly block a specific malicious IP/range, use a NACL deny rule per subnet. Do normal inter-tier allows with SGs (SG as source), combining both for layered defense.

Warning

Exam trap: Trying to create a "deny specific IP" rule in an SG is wrong—SGs are allow-only with no deny rules. Explicit deny is via NACL. Also, NACLs are stateless, so allowing inbound without separately allowing the return (outbound ephemeral ports) breaks the connection (SGs are stateful and auto-allow).

3.1.2Section summary

  • Layered = SG (instance/allow-only) + NACL (subnet/can-deny)
  • Private access = VPC endpoints/PrivateLink / egress = NAT

Sign in to track progress — Log in.

Quick check

(just a quick review)

Q1. Explicitly deny traffic from a malicious IP range at the subnet level. What?

Q2. Connect from EC2 to S3 privately without traversing the internet. What?

Q3. Which statement about security groups is correct?

Check your understandingPractice questions for Chapter 3: Infrastructure Security