Ref: https://learn.cantrill.io/courses/1820301/lectures/41301379
VPC Flow Logs
- đź”§Â Monitor traffic flow to and from ENIs within a VPC
- ‼️ ONLY capture packet metadata!
- e.g. SRC/DST IPs, ports… → anything to do with flow of data through VPC
- ❗ Flow Logs do NOT capture packet contents!! → Need a packet sniffer for that
- ‼️ NOT real-time!!
- delay present, best effort
- Three different levels of attachment (capture from specified point downwards)
- VPC-level → captures flow to and from all ENIs in all subnets of the VPC
- Subnet-level → captures flow to and from all ENIs in this subnet
- ENI-level → direct attachment, captures only flow to and from this particular ENI
- âť—Â Can capture accepted, rejected or ALL metadata
- Possible Log Destinations:
- S3
- CWLogs
- âť—Â NOT ALL types of traffic logged with Flow Logs! Some excluded stuff:
- EC2 Metadata service (
http://169.254.169.254
)
- Any accesses to metadata service running inside EC2 instances won't be logged
- Time server requests (
http://169.254.169.123
)
- Uses Network Time Protocol (NTP)
- DHCP requests running inside the VPC
- Communications with Amazon DNS server
- Communications with Amazon Windows license server (Windows EC2 instances)
- Architecture Diagram
Flow Log Records
- Each row captures the flow of a packet through the ENI, with several fields
- Important fields:
srcaddr
, dstaddr
, srcport
, dstport
, protocol
, action
- Important protocol numbers (assigned by IANA):
- 1 → ICMP (Internet Control Message Protocol)
- Typical networking “ping” uses ICMP
- 6 → TCP
- 17 → UDP
- Example Flow Logs from an ICMP ping (common connectivity and latency assessment)