---
title: "Analyzing AWS Flow Logs using ClickHouse"
description: "VPC Flow Logs exported to S3 as Parquet can be loaded into ClickHouse and queried with SQL to find rejected traffic, top talkers, internet ingress/egress and costly cross-AZ transfers."
url: "https://swe.quest/articles/analyzing-aws-flow-logs-using-clickhouse-23253efe677ab3d4"
canonical: "https://clickhouse.com/blog/analyzing-aws-fow-logs-using-clickhouse"
source: "ClickHouse"
published: "2023-02-06"
difficulty: "medium"
kind: "How-to"
reading_minutes: 12
tags: ["analytics","cloud","networking","cost-optimization","sql"]
---

# Analyzing AWS Flow Logs using ClickHouse

A post on [ClickHouse](https://swe.quest/sources/clickhouse.md), published 2023-02-06, 12 min read, How-to. Original: [https://clickhouse.com/blog/analyzing-aws-fow-logs-using-clickhouse](https://clickhouse.com/blog/analyzing-aws-fow-logs-using-clickhouse)

## Summary

VPC Flow Logs exported to S3 as Parquet can be loaded into ClickHouse and queried with SQL to find rejected traffic, top talkers, internet ingress/egress and costly cross-AZ transfers. The walkthrough infers a schema with clickhouse local, then tunes it with LowCardinality strings, IPv4 and DateTime types, an Enum for action, and a sort key on action, srcaddr, dstaddr, protocol and time. About 517M rows compress to 2.3 GiB. Import runs via the s3() table function in roughly 12 minutes, and aggregation queries finish in 0.6 to 30 seconds. Enriching flows with EC2 metadata from the AWS API supplies the availability zone mapping needed to attribute cross-AZ traffic.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Analytics & OLAP](https://swe.quest/tags/analytics.md) (Data & databases)
- [Cloud platforms](https://swe.quest/tags/cloud.md) (Infrastructure)
- [Networking](https://swe.quest/tags/networking.md) (Infrastructure)
- [Cost optimization](https://swe.quest/tags/cost-optimization.md) (Reliability & operations)
- [SQL](https://swe.quest/tags/sql.md) (Languages)

## Prerequisites

- AWS VPC basics ([easy posts on Cloud platforms](https://swe.quest/tags/cloud.md?difficulty=easy))
- SQL ([easy posts on SQL](https://swe.quest/tags/sql.md?difficulty=easy))

## Keywords

ClickHouse, AWS VPC Flow Logs, Parquet, Amazon S3, MergeTree, LowCardinality

## Related posts

- [How Cloud CIRCUS used ClickHouse to speed up and simplify log analytics](https://swe.quest/articles/how-cloud-circus-used-clickhouse-to-speed-up-and-simplify-log-analytics-2fa577e0b57d75c9.md): ClickHouse · 2025-06-17 · Medium · 6 min read · Analytics & OLAP, Data pipelines, Cloud platforms, Cost optimization, Observability
  Cloud CIRCUS replaced Amazon Athena with a self-managed ClickHouse instance on a single 4 vCPU / 32 GB EC2 machine to analyze CloudFront access logs from 2,000+ BlueMonkey customer sites.
- [How Buildkite transformed test analytics and cut costs with ClickHouse Cloud](https://swe.quest/articles/how-buildkite-transformed-test-analytics-and-cut-costs-with-clickhouse-cloud-3d237a53f50d4550.md): ClickHouse · 2026-01-27 · Easy · 8 min read · Analytics & OLAP, Cost optimization, Stream processing, CI/CD, Testing
  Buildkite Test Engine replaced a Kafka/Flink pipeline that pre-aggregated test metrics into Postgres, DynamoDB and Iceberg with on-demand queries against ClickHouse Cloud, letting customers group and filter billions of test executions by arbitrary JSON tags in real time.
- [How we Built a 19 PiB Logging Platform with ClickHouse and Saved Millions](https://swe.quest/articles/how-we-built-a-19-pib-logging-platform-with-clickhouse-and-saved-millions-5704529f91592f0b.md): ClickHouse · 2024-04-02 · Medium · 32 min read · Observability, Analytics & OLAP, Cost optimization, Scaling, System design
  ClickHouse replaced Datadog for internal logging with LogHouse, a per-region ClickHouse deployment holding over 19 PiB uncompressed (37 trillion rows) for its AWS regions.
- [Clever ingests 200x more logs at the same cost with ClickHouse Cloud](https://swe.quest/articles/clever-ingests-200x-more-logs-at-the-same-cost-with-clickhouse-cloud-cafdd48afca59e57.md): ClickHouse · 2026-06-30 · Medium · 8 min read · Observability, Analytics & OLAP, Cost optimization, System design
  Clever replaced a split Datadog/Athena logging setup with ClickHouse Cloud.
- [How Jump Trading uses ClickHouse with Iceberg for analytics](https://swe.quest/articles/how-jump-trading-uses-clickhouse-with-iceberg-for-analytics-1cafb9464ead1735.md): ClickHouse · 2026-07-30 · Medium · 6 min read · Analytics & OLAP, Data pipelines, Distributed databases, Performance engineering
  Jump Trading runs a self-managed, on-prem ClickHouse cluster of tens of nodes as the system of record for petabyte-scale trading logs, ingesting hundreds of TB per day with peaks of 10M rows/sec and a sub-20-second p99, reconciled daily for zero data loss.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
