Loading tutorials…
Loading tutorials…
Self-hosting PostHog looks cheaper on paper. It almost never is. This walks through the real cost math, the operational burden most teams underestimate, and the 3 scenarios where self-hosted actually wins.
Who this is forCTOs, engineering leads, and founders evaluating PostHog deployment. Especially relevant if you have a compliance requirement, a data-residency commitment, or you have heard "self-hosted is cheaper" and want to verify before committing.
What you'll need
Step 1
PostHog Cloud is event-volume priced and scales with you. Self-hosted has fixed infra costs + huge ops time. Cloud usually wins until ~10M+ events/mo.
PostHog Cloud (pay-as-you-go): 1M free events + $0.00031/event after. 5M events = $1,240/mo. 50M events = $14,600/mo. Plus replay, flags, surveys metered separately.
Self-hosted minimum infra (AWS/GCP): 3x ClickHouse nodes (m5.2xlarge), 3x Kafka brokers, 1x web tier, 1x worker tier, 1x Redis, 1x Postgres = ~$2,200-3,500/mo in cloud infra alone. Plus storage at scale.
Operational time: realistically 0.25-0.5 FTE of senior DevOps / data engineer for a self-hosted PostHog. At $180K/yr fully-loaded that is $45K-90K/yr in opex.
Real total cost of self-hosted PostHog at moderate scale: ~$70K-110K/yr. Same workload on Cloud: ~$30K-50K/yr for ~20M-30M events/mo equivalent.
Self-hosted wins below the line ONLY at ~100M+ events/mo where Cloud pricing exceeds ~$30K/mo AND you have a real DevOps team. Below that scale, Cloud is cheaper after total cost of ownership.
Step 2
Hard data-residency requirement, air-gapped network, or 100M+ events/mo with mature DevOps. Outside these, Cloud is the right call.
(1) Hard data-residency requirement in customer contract — e.g. a government, defense, or healthcare customer requires data stays on YOUR infrastructure, not a third party. EU Cloud often satisfies this; check first.
(2) Air-gapped network — your product runs on an isolated network with no internet access. Self-hosted PostHog can run on an internal Kubernetes cluster. Cloud cannot.
(3) 100M+ events/month AND mature DevOps team — at this scale, Cloud is $30K+/mo and a self-hosted deploy can be 30-50% cheaper IF you have the ops capacity to run ClickHouse well.
Outside these three: you are paying with engineering time to "save" cash. The math almost always favors Cloud.
Step 3
ClickHouse tuning, Kafka backpressure, Postgres migrations, upgrade-day pain. Honest checklist of what you are signing up for.
ClickHouse: you own query optimization. A bad query from a dashboard can OOM a node. You need someone who has tuned ClickHouse before, or you are about to learn.
Kafka: backpressure during traffic spikes. Disk-full conditions. Consumer-lag monitoring. Topic-retention tuning. All Day-2 ops.
Postgres: PostHog's metadata DB. Schema migrations on upgrade. Connection-pool tuning. Vacuum management.
Upgrade migrations: PostHog ships frequently. Each upgrade involves Helm chart updates, sometimes ClickHouse migrations that take hours, occasionally breaking changes.
Capacity planning: events grow. Recording storage grows. Disk grows. You manage it. Cloud auto-scales.
Backup / DR: you own it. Hourly snapshots, off-site replication, RTO / RPO. PostHog ships docs; the work is yours.
Step 4
For most teams that "want self-hosted for data ownership," the real answer is Cloud + a warehouse mirror. You get the product on Cloud and a copy of the data in your BigQuery / Snowflake.
PostHog Cloud ships every event to your data warehouse in near real-time. You own the raw data; PostHog owns the operational complexity.
Set up: Data Pipelines → Destinations → BigQuery / Snowflake / S3. Add credentials. PostHog streams every event with a 5-15 min lag.
Now you can: run any custom analytics in your warehouse, integrate with dbt / Looker / Tableau, retain raw data beyond PostHog's default retention.
This satisfies 80% of "we want self-hosted for data control" arguments. The remaining 20% (air-gap, hard residency) still need self-hosted.
Step 5
Yes/no checklist for self-hosted: data residency, air-gap, scale + ops capacity. Default is Cloud.
□ Do you have a customer contract requiring data on YOUR infrastructure (not just EU residency)? If yes → self-hosted. If no → continue.
□ Is your product on an air-gapped network with no internet access? If yes → self-hosted. If no → continue.
□ Are you projecting 100M+ events/mo within 12 months AND you have a dedicated DevOps engineer with ClickHouse experience? If yes → self-hosted may make sense. If no → Cloud.
□ Default answer: Cloud + warehouse mirror.
Most teams that 'want' self-hosted are actually solving for data ownership (warehouse mirror solves this) or perceived cost savings (math doesn't pencil at sub-100M scale).
Common mistakes
Self-hosting "to save money" without ops capacity
What goes wrong: Series A startup self-hosts to save $2K/mo on Cloud. The deploy works fine for 4 months. Then ClickHouse hits a memory issue at month 5. Senior engineer spends 3 weeks debugging instead of building product. Estimated lost product velocity: $40K-80K in lost engineering output to 'save' $24K/yr.
How to avoid: Run the total-cost-of-ownership math. Include engineering time at fully-loaded cost ($180K-250K/yr). Self-hosted is rarely cheaper below 100M events/mo with TCO.
Self-hosting Hobby version in production
What goes wrong: Team runs PostHog Hobby (single-node Docker compose) in production. Six months in, the disk fills up. Service goes down. No HA, no failover. You lose 3 days of events and the analytics team has no data to debug a launch with.
How to avoid: If self-hosting, use the production Kubernetes deploy with proper HA + monitoring + backups. Hobby is for testing and tiny internal tools only.
Migrating to self-hosted mid-growth
What goes wrong: Started on Cloud. Hit Series B traction. Decide to migrate to self-hosted 'to scale better.' Migration is a 2-3 month project with historical-data export, schema validation, downtime windows. Cost: $200K+ in engineering time. The 'savings' would have paid back in year 4.
How to avoid: Stay on Cloud through Series B unless you have a compliance requirement forcing the migration. Cloud auto-scales — you do not need to migrate to handle growth.
No warehouse mirror on Cloud
What goes wrong: On Cloud. You assume your data is locked in PostHog. When you eventually want custom analytics in Looker / Mode / Hex, you cannot get raw data out fast enough. Decisions get blocked on data exports.
How to avoid: Set up Data Pipelines → BigQuery (or Snowflake / Redshift) on day one. You own a copy of every event in your warehouse, always. PostHog handles the product analytics layer.
Choosing self-hosted for "GDPR compliance"
What goes wrong: You self-host PostHog to 'be GDPR compliant.' But you do not actually have a DPA process, do not honour DSARs in 30 days, and do not have lawful basis documented. Self-hosting did not make you compliant — process did. Six months later a customer audit finds the gaps and you have to redo the work.
How to avoid: PostHog EU Cloud is GDPR-compliant by default with proper DPA. Self-hosting does not automatically make you compliant; the work is in your process. Pick deployment based on actual residency requirements, not "compliance" as a vague reason.
Recap
Done — what's next
How to set up a PostHog account the right way
Read the next tutorial
Hand it off
This is a high-stakes decision with second-order consequences for the next 2-3 years of your engineering team. Get a second opinion before committing. EverestX matches you with a vetted PostHog / data-engineering specialist who has lived both sides — typically a 1-2 hour consultation, from $14-16/hr.
Get a real opinion
Approximate ranges: 5M events/mo + 50K recording minutes + 5M flag requests = ~$1,800-2,400/mo. 20M events/mo + 200K recording minutes = ~$8,000-10,000/mo. 100M events/mo = ~$32,000-40,000/mo. Volume discounts kick in above $10K/mo on annual contracts.
Yes — PostHog provides export tools (BigQuery sync, full event export). Migration takes 2-4 weeks of engineering time. Historical session recordings cannot be migrated (events yes, recordings no). Plan ahead if recording history matters.
At least one senior engineer with ClickHouse experience and ops capacity for 10-20 hours/week. Realistically, you want a dedicated DevOps engineer or a Senior+ data engineer with 25-50% time allocation to the deploy. Smaller teams cannot sustain a production self-hosted PostHog reliably.
Some Enterprise features (SSO, advanced permissions, audit logs, SAML) are part of the paid PostHog license, available on both Cloud (Teams/Enterprise plans) and self-hosted (PostHog Enterprise license, ~$5K-30K/yr depending on scale). The base product is feature-equivalent.
Docker Compose (Hobby): single-node, dev / tiny-team only. Not production. Kubernetes (Helm chart): production deployment. Requires a managed K8s cluster (EKS / GKE / AKS) and a real ops team. PostHog maintains the official Helm chart at github.com/PostHog/charts.
PostHog
PostHog is generous on the free tier but expensive when you outgrow it without realising. This walks through account setup, region choice (US vs EU), org structure, and the billing-cap settings that stop a runaway event from becoming a $4,000 surprise.
PostHog
All three are good. The right one depends on your event volume, team mix, and what else you want bundled. This walks through the honest tradeoffs — pricing math at different scales, product analytics quality, and the all-in-one vs best-of-breed decision.
PostHog
DIY PostHog is the right call up to a point. Then it isn't. This is the honest framework: when the cost of self-managing exceeds the cost of hiring, and how to tell which side you're on.
PostHog
PostHog has a one-line install — and a hundred ways to get it wrong. This walks through web, Next.js App Router, React Native, and the server SDK (which you need for any event that can't be lost). With the autocapture gotchas that show up at month two.