Domain Filtering and Egress Control
Restrict which external destinations your workloads can reach.
Domain Filtering and Egress Control is a free AWS Security Academy lesson on CoddyKit — lesson 3 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the AWS Security Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
Why Control Egress
Most firewalls focus on inbound traffic, but egress (outbound) control is critical for security. Compromised workloads call out to attacker servers to receive commands or exfiltrate data. Restricting which destinations your resources can reach cuts off this path and limits the damage of a breach.
The Limits of SGs and NACLs
Security groups and NACLs can restrict outbound traffic only by IP and port, not by domain. Since attacker infrastructure uses rotating IPs and shared cloud hosts, IP-based egress rules are brittle. Domain-based filtering in Network Firewall solves this by controlling destinations by name.
Domain Allow-Lists
A domain allow-list permits outbound traffic only to approved domains, such as your software repositories, AWS service endpoints, and partner APIs, blocking everything else. This deny-by-default posture means even a compromised host cannot reach unknown command-and-control servers.
# Egress allow-list (concept)
Allow: .amazonaws.com, .github.com, updates.example.com
Default: DROPDomain Deny-Lists
A domain deny-list takes the opposite approach, blocking known-bad or unwanted domains while allowing the rest. Allow-lists are stronger for high-security environments, while deny-lists suit less restrictive workloads where blocking everything would be impractical.
How Domains Are Matched
Network Firewall inspects the TLS SNI (Server Name Indication) for HTTPS and the HTTP Host header for plaintext to determine the destination domain. Because SNI is sent in the clear during the TLS handshake, the firewall can filter HTTPS by domain without decrypting the traffic.
Preventing Data Exfiltration
Egress filtering directly counters data exfiltration. If an attacker tries to upload stolen data to an unapproved cloud-storage or paste site, the domain rule blocks the connection. Combined with logging, you also get an alert that an attempt occurred, aiding detection.
Blocking Command and Control
Malware typically beacons to command-and-control (C2) domains to receive instructions. A strict egress allow-list breaks this loop because the C2 domain is not on the list, neutralizing many malware families even after initial infection. This is a key containment control.
Centralized Egress
In multi-VPC setups, route all outbound traffic through a central inspection VPC running Network Firewall via a transit gateway. One egress policy then governs every workload, and a single set of domain rules is consistently enforced organization-wide, simplifying both security and auditing.
Interaction with NAT
Egress filtering usually sits alongside a NAT gateway in the outbound path. Traffic flows from private subnets through the firewall, then NAT, to the internet. Route tables must send traffic through the firewall endpoint before NAT so inspection happens on every outbound connection.
Logging Egress Decisions
Send Network Firewall alert and flow logs to your log pipeline so you can see which egress attempts were blocked and which domains workloads contact. Unexpected blocked domains can reveal compromise, while the allowed list helps you right-size and tighten the policy over time.
A Layered Egress Strategy
Effective egress security layers domain allow-lists, default-drop strict ordering, centralized inspection, and thorough logging. This turns outbound traffic from an open door into a tightly governed, observable channel, a control the SCS-C02 exam emphasizes for containing breaches.
Quick Check
Apply egress-filtering reasoning.
Recap
Egress control stops compromised hosts from reaching attacker infrastructure. Because security groups and NACLs filter only by IP and port, use Network Firewall domain allow-lists or deny-lists, matching the TLS SNI and HTTP Host without decryption. This blocks command-and-control beacons and data exfiltration. Centralize egress through an inspection VPC, place the firewall before NAT, and log all decisions.
Frequently asked questions
Is the “Domain Filtering and Egress Control” lesson free?
Yes — the full text of “Domain Filtering and Egress Control” is free to read here on the web, and the AWS Security Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the AWS Security Academy course, upgrade to CoddyKit PRO.
What will I learn in “Domain Filtering and Egress Control”?
Restrict which external destinations your workloads can reach. You practise AWS Security Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start AWS Security Academy?
No prior experience is required. AWS Security Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 3 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “Domain Filtering and Egress Control” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this AWS Security Academy lesson?
Yes. Every AWS Security Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- What AWS Network Firewall Provides
- Stateful Rule Groups and Suricata Rules
- Domain Filtering and Egress Control
- Securing the CloudFront Edge