AWS in 1 Min · Episode 58

AWS VPC Flow Logs explained

Who talked to whom. Watch the one-minute video, then read the details.

David Gomez1:17 video · 3 min read

"Flow Logs show what's inside your traffic." They don't. VPC Flow Logs record the envelope, not the letter: who talked to whom, on which port, and whether the traffic was allowed. They never capture the content of the packets. That's exactly what makes them cheap enough to leave on, and it's why they are the first place to look when a connection fails or something strange is talking to your servers.

What a flow log captures

A flow log captures metadata about the IP traffic going to and from the network interfaces in your VPC. Each record summarises one flow over a short window of time. The default format includes, among other fields:

  • the source and destination IP addresses
  • the source and destination ports
  • the protocol (TCP, UDP, ICMP and so on)
  • the number of packets and bytes
  • the start and end time of the window
  • the action: ACCEPT or REJECT

Where to turn them on, and where they go

You can create a flow log at three levels:

  • a whole VPC
  • one subnet
  • a single network interface

You can also choose to record accepted traffic, rejected traffic, or all of it.

Flow logs can be published to three destinations:

  • Amazon CloudWatch Logs, good for searching and alarms
  • Amazon S3, cheaper for long-term storage and for querying with Amazon Athena
  • Amazon Data Firehose, to stream them on to other tools

You pay for the log data you publish and store, so busy VPCs can produce a noticeable bill. Decide how long you really need to keep them.

What they're good for

  • Finding the rule that blocks a connection. A REJECT record tells you the traffic arrived and was denied by a security group or network ACL. No record at all suggests it never arrived, so the problem is routing.
  • Spotting stateless mistakes. If you see an inbound ACCEPT and an outbound REJECT for the same conversation, a network ACL is blocking the reply. Security groups are stateful and wouldn't do that.
  • Seeing who is probing you. Rejected connections to ports like 22 or 3389 from all over the world show how much scanning an exposed address receives.
  • Evidence after an incident: which addresses a compromised server talked to, and when.

Two limits to know

  • No performance cost. Flow log data is collected outside the path of your traffic, so turning it on doesn't affect throughput or latency.
  • Not real time. Records are aggregated over a window (up to ten minutes by default; you can choose one minute) and then delivered, so expect a delay of minutes.

Some traffic is not recorded at all, including queries to the Amazon DNS server and requests to the instance metadata address. Flow logs also can't show you payloads; for that you'd need VPC Traffic Mirroring.

Where AI fits

Flow records are ideal input for machine learning: a huge, regular stream where "unusual" matters more than any single line.

AWS already does this for you. Amazon GuardDuty analyses VPC flow data, together with DNS and CloudTrail activity, using threat intelligence and machine learning to flag things like a server suddenly talking to a known malicious address or sending out unusual volumes of data. GuardDuty reads its own independent stream, so it works even if you haven't created any flow logs. Your own flow logs are still worth keeping, because GuardDuty doesn't make that raw data available to you for investigations.

Quick recap

  • Flow logs record metadata, not content.
  • The key field is the action: ACCEPT or REJECT.
  • Enable them per VPC, subnet or interface; send them to CloudWatch Logs, S3 or Firehose.
  • They don't slow the network, but they aren't real time.
AWS in 1 Min #58 · 1:17

Need an AWS expert on your team?

I'm David, an AWS expert and fractional cloud consultant. I work alongside your team to run your cloud and infrastructure: architecture, security, cost and day-to-day operations. You get senior AWS experience when you need it, without the cost of a full-time hire.

  • Architecture reviews and a clear plan for what to fix first
  • Security hardening: IAM, networking, audits
  • Lower AWS bills without slowing your team down
  • Hands-on help with AI workloads on AWS