What does managed Postgres actually cost beyond the instance-hour rate?
Comparisons fixate on the instance-hour rate because it is the most prominent number on the pricing page and maps neatly onto a Kubernetes node price. A production bill, though, has several line items that scale independently of compute. Any one of them can move the total as much as the instance choice.
| Line item | What drives it | Why it gets missed |
|---|---|---|
| Instance compute | Instance class × hours × instance count | Multi-AZ standbys and read replicas each bill as a full instance |
| Storage and provisioned IOPS | Allocated GB, plus IOPS bought separately on some storage types | Storage is billed on what you allocate, not what you use; IOPS-heavy workloads can outspend compute |
| Backup storage | Snapshot and retained-log volume beyond any included allowance | Grows with retention period and write churn, not database size alone |
| Data transfer | Cross-AZ app-to-database traffic, cross-region replicas, egress | Appears on a separate part of the bill and depends on application topology |
Illustrative estimate (assumed numbers, not a benchmark)
Monthly cost = (instance rate × 730 h × instances) + (GB × storage rate) + (IOPS × IOPS rate) + (billable backup GB × backup rate) + (transfer GB × transfer rate)
The assumed inputs are $0.50/h compute, primary plus standby, 1,000 GB at $0.12, 10,000 IOPS at $0.08, 2,000 billable backup GB at $0.095, and 5,000 GB transfer at $0.01:
$730 + $120 + $800 + $190 + $50 = $1,890, of which $1,160 (61%) is not compute.
Committed-use or reserved pricing changes the picture again. These discounts apply to instance-hours. If you assume a 35% compute discount, the bill falls to $1,634.50. A comparison of on-demand managed pricing against self-hosting therefore overstates the savings from running Postgres yourself.
How does self-hosted Postgres on Kubernetes work with CloudNativePG?
CloudNativePG is a Kubernetes operator. You declare a Cluster resource with an instance count, a storage size and class, and a backup target, and the operator works to keep the running state matching that declaration. The manifest that accompanies this section is close to the minimum: three instances, a persistent volume claim per instance, and WAL archiving to an object-store bucket with credentials taken from a Secret.
The resulting topology is one primary and two streaming replicas. Each runs in its own pod with its own persistent volume. The primary ships WAL segments continuously to object storage, and scheduled base backups land in the same bucket. Point-in-time recovery uses both: you bootstrap a new cluster from a base backup and replay archived WAL up to a chosen timestamp.
What the operator automates
- Creating the primary and replicas, and the read-write and read-only Services that route traffic to them.
- Promoting a replica when the primary fails, then repointing the read-write Service.
- WAL archiving and base backups.
- Rolling updates. Replicas are updated first, followed by a switchover or restart of the primary.
What stays with you
The operator only enforces the state you declare. It does not decide what that state should be or check that it is still right for your workload. That leaves you responsible for:
- Capacity planning
- Query and parameter tuning
- Testing major-version upgrades
- Running restore drills to prove your backups work
- Benchmarking storage
- Being on call
Kubernetes-specific failure modes
- Storage-class performance variance. The same storage class can deliver different IOPS and latency depending on node and zone.
- Volume attach and detach delays. These slow down rescheduling after a node fails.
- Node drains that hit the primary. Each one forces a switchover.
- Operator upgrade regressions. These reach every cluster the operator manages at the same time.
# Three-instance cluster: one primary, two streaming replicas, one PVC each.
apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
name: orders-db
spec:
instances: 3
storage:
size: 100Gi
storageClass: fast-ssd # benchmark this class; IOPS can vary by node and zone
backup:
retentionPolicy: "30d" # base backups and WAL older than this are pruned
barmanObjectStore:
destinationPath: s3://example-pg-backups/orders-db
s3Credentials:
accessKeyId:
name: pg-backup-creds # Secret created separately, never committed
key: ACCESS_KEY_ID
secretAccessKey:
name: pg-backup-creds
key: ACCESS_SECRET_KEY
wal:
compression: gzip # continuous WAL archiving, needed for PITR
data:
compression: gzip # base backup compression
---
# Nightly base backup at 02:00. CloudNativePG cron has a leading seconds field.
apiVersion: postgresql.cnpg.io/v1
kind: ScheduledBackup
metadata:
name: orders-db-nightly
spec:
schedule: "0 0 2 * * *"
backupOwnerReference: self
cluster:
name: orders-db
A minimal CloudNativePG Cluster with three instances, WAL archiving and base backups to S3-compatible object storage via the in-tree barmanObjectStore configuration (newer releases are moving this to the Barman Cloud plugin), plus a nightly ScheduledBackup.
What goes on the full self-hosted bill?
Those failure modes cost labour, which the next section prices. First come the infrastructure line items, because self-hosted estimates usually undercount them. Each row below pairs a self-hosted cost with the managed charge that covers the same function.
| Self-hosted line item | Closest managed equivalent | What each side tends to miss |
|---|---|---|
| Worker nodes for database pods (primary plus replicas) | Instance-hours for primary and standbys | Self-hosted: kubelet, DaemonSet and system-reserved headroom on every node |
| Persistent volumes (block storage, provisioned IOPS) | Provisioned storage and IOPS | Self-hosted: volume snapshots and over-provisioning for growth |
| Object storage for WAL archives and base backups | Automated backup and snapshot storage | Self-hosted: request and egress charges, cross-region copies |
| Monitoring stack (metrics, logs, alerting) | Built-in metrics plus paid extended retention | Managed: the external alerting you still run |
| Share of control plane and cluster overhead | Bundled into the instance price | Self-hosted: usually left out entirely |
Node sizing drives most of the gap. Database pods need guaranteed resources and anti-affinity, so replicas cannot share a node. That usually means a dedicated node pool, and the pool's unused capacity is paid for whether or not anything runs on it. A managed instance hides this overhead inside one hourly rate.
Allocate cluster overhead by resource share. The managed control-plane fee, ingress, the operator itself and shared logging should be charged to databases in proportion to the CPU and memory they reserve. If you skip this step, the self-hosted side looks cheaper than it is.
How do you price the ops time for running Postgres yourself?
Assume a fleet of 10 clusters run by one platform team. Hours are monthly and cover the whole fleet. Major upgrades are spread across the months between them.
Illustrative estimate (assumed numbers, not a benchmark)
| Task | Self-hosted (h/month) | Managed (h/month) |
|---|---|---|
| Minor upgrades, security patching | 4 | 0.5 |
| Major upgrades (amortized) | 3 | 2 |
| Backup/restore verification | 4 | 1 |
| Failover tests | 2 | 0.5 |
| Alert triage | 6 | 2 |
| Incident response | 6 | 3 |
| Parameter tuning, query work, connection management | 5 | 5 |
| Total | 30 | 14 |
Formula: (H_self − H_managed) × fully loaded hourly cost. At an assumed $100/hour, that is (30 − 14) × 100 = $1,600/month of extra ops time for self-hosting. Managed is not zero. You still tune queries, manage connections, plan major upgrades and handle incidents.
These averages run low because the cost is lumpy. A single storage incident, a failed major upgrade or a corrupted replica can take one engineer a full week. An untested restore costs nothing in the budget until the day you discover it doesn't work. Count unverified backups as an open liability, not as savings.
On-call does not scale with the number of clusters. A sustainable rotation needs several engineers who can debug WAL, replication and storage under pressure. You need that whether you run three clusters or thirty. Price the rotation as fixed headcount. Also account for concentration risk: if one or two people hold the real expertise and one leaves, the hours in this table understate your exposure.
At what fleet size does self-hosting Postgres break even?
Treat the ops rotation as a fixed monthly cost and the managed premium as a per-instance saving. Self-hosting breaks even at the fleet size where the per-instance savings cover the fixed cost:
N = F / P
- F = (ops hours per month × loaded hourly rate) + on-call compensation
- P = managed monthly cost per instance − self-hosted infrastructure cost per comparable instance
Round N up. In practice ops hours grow somewhat with fleet size, so this model is optimistic for self-hosting.
Illustrative estimate
Assumed inputs: $100/hour loaded rate, $2,000/month on-call cost, $600/month managed list price per instance, and $250/month for equivalent self-hosted compute, storage, and backup storage. The discount column is the discount you negotiate on the managed price.
| Ops hours/month | F (monthly) | List price (P = $350) | 20% discount (P = $230) | 40% discount (P = $110) |
|---|---|---|---|---|
| 40 | $6,000 | 18 instances | 27 instances | 55 instances |
| 80 | $10,000 | 29 instances | 44 instances | 91 instances |
| 160 | $18,000 | 52 instances | 79 instances | 164 instances |
Discounts move the break-even point more than ops hours do. Going from list price to a 40% discount roughly triples N, because the discount shrinks the gap that self-hosting depends on.
Small fleets rarely break even because F has a floor. A credible rotation, backup restore drills, and upgrade testing cost about the same whether you run five clusters or fifty. With five instances, every hour of that floor is spread across very little savings.
import math
# Illustrative estimate only: replace these assumed inputs with your own.
LOADED_RATE = 100 # $/hour, fully loaded engineer cost
ON_CALL = 2_000 # $/month on-call compensation
MANAGED_LIST = 600 # $/month managed list price per instance
SELF_HOSTED = 250 # $/month compute + storage + backup storage per instance
OPS_HOURS = [40, 80, 160] # ops hours per month for the fleet
DISCOUNTS = [0.0, 0.20, 0.40] # negotiated discount on managed price
def break_even(ops_hours, discount):
fixed = ops_hours * LOADED_RATE + ON_CALL # F
premium = MANAGED_LIST * (1 - discount) - SELF_HOSTED # P
if premium <= 0:
return None # managed is as cheap or cheaper per instance: never breaks even
return math.ceil(fixed / premium) # round up: N = F / P
header = "hours/mo | " + " | ".join(f"{int(d * 100)}% off" for d in DISCOUNTS)
print(header)
for h in OPS_HOURS:
cells = []
for d in DISCOUNTS:
n = break_even(h, d)
cells.append("never" if n is None else f"{n} inst")
print(f"{h:>8} | " + " | ".join(cells))
# Expected output with the inputs above:
# 40 | 18 inst | 27 inst | 55 inst
# 80 | 29 inst | 44 inst | 91 inst
# 160 | 52 inst | 79 inst | 164 inst
A small Python script that computes the break-even fleet size N = ceil(F / P) across ops hours and managed-price discounts, reproducing the illustrative sensitivity table so readers can substitute their own inputs.
Who should self-host Postgres on Kubernetes, and when should you avoid it?
Self-hosting wins when three conditions hold at once. First, you already run production Kubernetes with working storage classes, node pools, monitoring, and an on-call rotation. CloudNativePG then adds an operator to a platform you maintain anyway, not a new platform. Second, at least two engineers can own database operations: reading pg_stat_activity during an incident, tuning autovacuum, and reasoning about failover and replication lag. Two is the minimum because one person is a single point of failure for the rotation. Third, the fleet is large enough that the fixed cost of the rotation, the drills, and upgrade testing is small per cluster compared with the managed-service premium you avoid.
Avoid self-hosting if any of the following apply:
- The fleet is small. A handful of instances rarely saves enough to pay for the ops floor.
- Nobody on staff knows Postgres well. The operator automates routine tasks but cannot diagnose bloat, lock contention, or a stuck replica.
- Restores are never tested. Backups that are never restored are unverified. Without scheduled restore drills, you carry risk that a managed service would otherwise absorb.
- You depend on provider features. Integrated storage autoscaling, managed cross-region replicas, and console-based audit tooling each become a project to build and maintain yourself.
Count the opportunity cost as well. Every sprint platform engineers spend on database upgrades and failover testing is a sprint they do not spend on deploy pipelines, developer environments, or other tooling the rest of engineering is waiting for.
What non-cost factors and alternatives should shape the decision?
Some constraints can settle the decision before cost is considered:
- Data residency. If you must run in a region your provider does not serve, or fully on-prem, managed Postgres is not an option.
- Portability. Each managed service has its own parameter groups, backup formats and IAM integration. A CloudNativePG cluster defined in manifests behaves much the same on any conformant Kubernetes cluster, including on-prem.
- Extensions. Managed services only allow extensions from their approved list. If you need a custom C extension or a niche one they do not ship, you have to run Postgres yourself.
- Superuser and filesystem access. Managed services give you a restricted admin role rather than true superuser, and no shell access. Some debugging tools, custom archive commands and low-level tuning need both.
| Option | Cost profile | Ops burden | Control | Portability |
|---|---|---|---|---|
| Managed, on-demand | Highest unit price, no commitment | Lowest | Limited | Low |
| Managed, committed discount | Lower unit price, locked term | Lowest | Limited | Lowest, because the term ties you in |
| Self-hosted, Kubernetes operator | Low infrastructure cost, high fixed staff cost | Moderate. The operator handles failover and backups, but you own upgrades and incidents | Full | High |
| Self-hosted, plain VMs | Low infrastructure cost, highest staff cost | Highest. You script failover, backups and patching | Full | Moderate |
Engineering time follows the ops burden column. Managed options let application teams build against a stable endpoint, at the cost of losing extensions and access. Self-hosting gives you that control, but it adds work that platform engineers carry and that competes with other platform roadmap items. An operator reduces this work compared with plain VMs, but it does not remove it. You still need people who understand both Postgres and Kubernetes when something fails at 3 a.m.
How OneEnv can help
Disclosure: OneEnv is the product behind this blog.
OneEnv (oneenv.io) is a workspace-based governance platform for the things services share — environment variables, database structure, API routes and validation rules. A change to a shared value is staged on a branch, reviewed once, and then every affected service explicitly approves or rejects it before it goes live, so you can see who a change touches before it ships instead of finding out in production.
Applied to managed postgres vs self hosted cost, this is where it helps:
Saves time
- Every service that inherits a shared value is listed in one place, so nobody searches repos and chats to find out who is affected.
- One review per branch replaces coordinating each team separately; each service still keeps its own approve/reject.
- Changing a shared variable is one edit and one review instead of editing every service's
.envby hand.
Saves cost
- Fewer production incidents and rollbacks caused by a shared value, route or column changing under a consumer unannounced.
- Less duplicated configuration to maintain: one shared definition inherited by many services.
- A wrong or stale value is caught at review time by the services it affects, not by a failed deploy.
- OneEnv has a free plan (1 workspace, unlimited services and members, full governance), so trying it costs nothing.
These are qualitative benefits, not measured results — how much you save depends on how many services share the value.
Want to try it? Start at oneenv.io.