Volume 2 · Chapter 9 — AWS Networking Deep Dive (VPC)
NAT Options, Flow Logs, and Traffic Monitoring
9.1 Introduction
This chapter deepens two operational networking areas the exam tests: the NAT choices (managed NAT gateway versus self-managed NAT instance, and how to make NAT highly available), and the tools for seeing and analyzing VPC traffic - VPC Flow Logs, Traffic Mirroring, and Reachability Analyzer. Architects must know these to design resilient egress and to troubleshoot and monitor networks.
9.2 NAT Gateway vs NAT Instance
Both give private-subnet resources outbound-only internet access, but they differ sharply. ANAT gatewayis AWS-managed: highly availablewithin an AZ, automatically scales bandwidth (up to tens of Gbps), needs no patching, and is the recommended default. ANAT instanceis an EC2 instance you run and manage: cheaper at small scale but you patch it, its bandwidth is the instance’s, it’s a single point of failure unless you build failover, and you must disable the instance’s source/destination check. Exam-relevant differences: a NAT gateway can’t use security groups (it uses the subnet’s NACL), while a NAT instance can (it’s an EC2 instance); a NAT instance can double as a bastion or do port forwarding, a NAT gateway cannot. For high availability, a NAT gateway lives in one AZ, so you deployone NAT gateway per AZand point each AZ’s private subnets at their local NAT gateway - which also avoids cross-AZ data charges. Prefer NAT gateways unless a specific NAT-instance capability is required.
flowchart TB
subgraph AZa[AZ A]
PrivA[Private subnet] --> NGWa[NAT Gateway A]
NGWa --> IGW[Internet Gateway]
end
subgraph AZb[AZ B]
PrivB[Private subnet] --> NGWb[NAT Gateway B]
NGWb --> IGW
end
Note[One NAT gateway per AZ: HA + no cross-AZ charges] -.-> NGWa 9.3 VPC Flow Logs
VPC Flow Logscapture metadata about IP traffic - source/destination IP and port, protocol, packet/byte counts, and whether traffic was ACCEPTed or REJECTed - at the level of a VPC, a subnet, or an ENI. They’re published to CloudWatch Logs, S3, or Kinesis Data Firehose for analysis (e.g. Athena queries). The key points: flow logs capturemetadata, not packet contents(so they show that traffic happened and whether it was allowed, not the payload), and the ACCEPT/REJECT field is invaluable for troubleshooting security groups and NACLs - a REJECT tells you a firewall blocked traffic. Flow logs are the primary tool for auditing and diagnosing what traffic is actually flowing (or being blocked) in a VPC, and for detecting anomalies.
9.4 Traffic Mirroring and Reachability Analyzer
Two more tools round out network visibility.Traffic Mirroringcopies actual packet content from an ENI to a monitoring appliance (an IDS/IPS or analysis tool) - unlike flow logs, it captures full packets, for deep security inspection and forensics.VPC Reachability Analyzeris a configuration-analysis tool that tests whether a path exists between two resources (say an instance and a database) and, if not, tells you which component - a route, security group, or NACL - is blocking it, without sending real traffic. AndNetwork Access Analyzeridentifies unintended network access paths for security review. For the exam: flow logs = metadata of traffic that happened; Traffic Mirroring = full packet capture for inspection; Reachability Analyzer = does a path exist and what’s blocking it (static analysis).
9.5 Banking Production Scenario
A bank deploys a NAT gateway in each AZ’s public subnet, with each AZ’s private application subnets routing outbound through their local NAT gateway - so an AZ failure doesn’t sever egress for the others and no cross-AZ charges accrue. VPC Flow Logs on all subnets flow to S3 and are queried in Athena for security auditing; the REJECT records feed anomaly detection and help engineers confirm when a security group or NACL blocked something during an incident. For its most sensitive tier, Traffic Mirroring sends packet copies to an intrusion-detection appliance. When a new service can’t reach the database, an engineer runs Reachability Analyzer, which pinpoints a missing security-group rule in seconds. This layered NAT resilience and traffic visibility is standard architect-level network operations.
9.6 Chapter Revision Notes
- NAT gateway (managed, HA within an AZ, auto-scaling, no SGs, recommended) vs NAT instance (self-managed EC2, uses SGs, can be bastion, SPOF unless you build HA, disable source/dest check).
- Deploy one NAT gateway per AZ with zone-local routing for HA and to avoid cross-AZ data charges.
- VPC Flow Logs capture traffic metadata (5-tuple, counts, ACCEPT/REJECT) to CloudWatch/S3/Firehose - not packet contents; REJECT helps diagnose SG/NACL blocks.
- Traffic Mirroring copies full packets to a monitoring appliance for deep inspection.
- Reachability Analyzer statically tests whether a path exists and what’s blocking it; Network Access Analyzer finds unintended access paths.