Diagnosing Traffic with VPC Flow Logs and Reachability Analyzer
This lesson explains how VPC Flow Logs show what traffic actually reached network interfaces and how VPC Reachability Analyzer shows whether the configuration allows a path.
Learning outcomes
After completing this lesson, you will be able to:
- Interpret flow log records.
- Run Reachability Analyzer.
- Combine both tools to find a block.
VPC Flow Logs
Flow logs capture metadata about IP traffic for a VPC, subnet, network interface, or a transit gateway or its attachments. Each record contains (in the default format) version, account ID, interface ID, source and destination addresses and ports, protocol, packets, bytes, start and end time, action (ACCEPT or REJECT) and log status; custom formats add fields such as vpc-id, subnet-id, instance-id, tcp-flags, pkt-srcaddr and pkt-dstaddr (original addresses behind NAT), flow-direction, traffic-path and reject-reason. Logs are delivered to CloudWatch Logs, S3 (with Parquet and Hive-compatible partitions for Athena) or Firehose, with a 1-minute or 10-minute aggregation interval. Flow logs do not capture packet payloads, traffic to the Amazon DNS server, instance metadata traffic, Amazon Time Sync, DHCP or Windows licence activation.
# Default format record: a rejected SSH attempt from the internet
2 111122223333 eni-0a1b2c3d 198.51.100.7 10.0.1.25 51544 22 6 3 180 1729000000 1729000060 REJECT OKInterpreting the action requires care. An inbound REJECT means the security group or NACL blocked the traffic. If an inbound record shows ACCEPT but the corresponding outbound response shows REJECT, the NACL is blocking the return traffic, because a security group would allow it automatically. No record at all suggests the traffic never reached the interface: a routing or upstream problem.
The following diagram shows a record and how to read it.

Reading flow logs
VPC Reachability Analyzer
Reachability Analyzer analyses the configuration between a source and destination (instances, network interfaces, internet gateways, VPC endpoints, transit gateway attachments, VPN gateways, load balancers and more), optionally with a protocol and port, without sending any packets. If the path is reachable, it shows every hop; if not, it names the blocking component and the reason, for example a security group with no matching inbound rule, a missing route or a NACL deny. It can analyse paths across accounts in an organisation and is ideal for verifying a configuration change before or after it is made. Network Access Analyzer complements it by finding all unintended paths that match a scope, such as any path from the internet to database subnets.
| Tool | Answers | Sends traffic |
|---|---|---|
| VPC Flow Logs | What traffic actually flowed and whether it was accepted or rejected | No (observes real traffic) |
| Reachability Analyzer | Can A reach B, and if not, which component blocks it? | No (configuration analysis) |
| Network Access Analyzer | Which unintended paths exist across the network? | No |
| Traffic Mirroring | Full packet content for deep inspection | Copies real packets |
Flow Logs or Reachability Analyzer?
Finding the block
An application server cannot connect to an RDS database on port 5432. The operator runs Reachability Analyzer from the server's network interface to the database's network interface with protocol TCP and port 5432. The result is Not reachable, with the explanation that the database's security group has no inbound rule matching the source. The rule allows 5432 from the old application security group, not the new one used after a redeployment. After the rule is changed to reference the new security group, a second analysis shows the path as reachable.
aws ec2 create-network-insights-path --source eni-0app --destination eni-0db \
--protocol tcp --destination-port 5432
aws ec2 start-network-insights-analysis --network-insights-path-id nip-0abc
aws ec2 describe-network-insights-analyses --network-insights-analysis-ids nia-0def \
--query 'NetworkInsightsAnalyses[0].[NetworkPathFound,Explanations[0].ExplanationCode]'Do VPC Flow Logs capture packet payloads?
Show answer
No. They record metadata and the ACCEPT or REJECT action.
Exam Tips
Remember for the exam
- Flow logs record metadata and ACCEPT/REJECT, not payloads, to CloudWatch Logs, S3 or Firehose.
- Inbound ACCEPT with outbound REJECT points to a NACL blocking return traffic.
- Reachability Analyzer names the blocking component without sending packets.
- Network Access Analyzer finds unintended paths across the network.
- Flow logs do not capture DNS to the Amazon resolver or metadata traffic.