What goes into the total cost of running Postgres?

When teams compare the rds vs self-hosted postgres cost, they usually compare instance prices. That leaves out most of the cost. Total cost falls into four buckets, and each one is billed or incurred differently depending on who runs the database.

  1. Compute and storage. The instances and volumes that hold your data.
  2. Backup storage and data transfer. Base backups, WAL archives, retention, and the network traffic that replication and backups generate.
  3. High-availability topology. Standby replicas, multi-zone placement, and the failover machinery that connects them.
  4. People time. Upgrades, tuning, on-call, incident response, and restore testing.
Cost bucket Managed service Self-hosted on Kubernetes
Compute and storage Per-instance-hour price that includes a management premium, plus provisioned storage Node capacity and persistent volumes at raw infrastructure rates
Backup storage and transfer Metered backup storage beyond any included allowance, plus cross-zone or cross-region transfer Object storage for base backups and WAL, plus the transfer you generate
HA topology Standby billed as extra instance capacity, with failover handled by the provider Extra replica pods and nodes spread across zones, with an operator handling failover
People time Mostly configuration, monitoring, and planning around provider maintenance windows Operator upgrades, storage issues, failover debugging, and restore drills

Instance price is the most visible line because it appears on every invoice. It is often the smallest line. Engineering hours and the risk of a failed recovery do not show up on an invoice, but they usually decide which option costs less. The rest of this article prices those hours explicitly so they can be compared against the instance bill.

How does it work? The two operating models side by side

Both options run the same Postgres engine. They differ in who runs the control loop around it: who provisions the server, replicates data, detects failure, promotes a standby, and stores backups.

Managed Postgres. The provider runs Postgres on hosts and storage you cannot access. You get a connection endpoint, a parameter group for configurable settings, and an API or console for lifecycle actions such as resize, restore and version upgrade. In a multi-zone deployment the provider keeps a standby in a second zone. It monitors the primary, and when the primary fails it promotes the standby and points the endpoint at the new primary, so clients reconnect to the same hostname. Backups are automated snapshots plus retained transaction logs, which is what makes restore-to-a-timestamp possible. Your side of the contract is schema, queries, sizing, parameters, and planning around maintenance windows.

Self-hosted with an operator. Postgres runs in pods, and each instance keeps its data on a persistent volume. An operator such as CloudNativePG watches a declarative resource that describes the desired cluster, then creates and repairs pods, volumes, replication and Services to match it. Clients connect through Kubernetes Services: CloudNativePG creates a read-write Service that always points at the primary, plus read-only Services for replicas. Failover is the operator noticing an unhealthy primary, promoting a standby, and repointing the read-write Service. Backups are WAL archived continuously to object storage plus scheduled base backups. Your side of the contract includes everything under the operator: the Kubernetes cluster, nodes, storage class, and the people who respond when one of those fails.

The practical difference is the failure surface. On managed Postgres, a failure below the database is the provider's incident. On Kubernetes, a stuck volume or an unhealthy node is your incident, even though the operator automates the database-level response.

Why does managed Postgres cost more than raw compute?

A managed instance usually costs more per hour than the same vCPU and memory bought as plain compute. The premium pays for operational work the provider runs on your behalf. The useful question is which of that work you would otherwise build, test and keep on call for.

Capability Managed service Self-hosted: what you own
Automated backups Scheduled snapshots and retention policy Backup tooling, object storage, retention pruning, alerting on missed backups
Point-in-time recovery Restore to a timestamp from the console or API Continuous WAL archiving, restore runbooks, regular restore drills
Minor-version patching Applied during a maintenance window Tracking releases, rolling upgrades, verifying extensions still load
Failover Standby promotion and endpoint switch Replication, leader election, connection routing, split-brain protection
Monitoring hooks Built-in metrics and log export Exporters, dashboards, alert rules, log shipping

Go through the right-hand column and mark each row as "we already run this" or "we would have to build it." Every unmarked row is engineering time you would add to the self-hosted side of the comparison.

The constraints are also part of the price:

  • No true superuser. You get an elevated role with restrictions. Some admin tasks and tools that assume full superuser access will not work.
  • A curated extension list. If an extension you need is not on the list, you cannot install it.
  • Maintenance windows you don't fully control. You pick the window. The provider can still require a patch by a set date.
  • Limited tuning. Some parameters are locked. File system, kernel and storage-layout settings are not available to you at all.

If one of these limits blocks a workload, the managed option costs more than its invoice shows, because you also pay for the workaround.

How does CloudNativePG work, and what does it leave to you?

CloudNativePG is a Kubernetes operator that takes over most of the database work a managed service would handle. You declare a Cluster resource and the operator reconciles it. A minimal manifest has three parts: an instance count, a storage size and storage class for each instance's persistent volume, and a backup section that points at an object storage bucket with credentials.

From that spec, the operator handles these tasks:

  • Bootstrapping. It runs initdb on the first instance, then clones standbys from it.
  • Streaming replication. It configures each standby to stream from the primary. If a standby falls behind, it can catch up from archived WAL.
  • Failover. If the primary fails its health checks, the operator promotes the most up-to-date standby and repoints the read-write Service to it.
  • Backups. It archives WAL continuously and takes base backups to object storage on a schedule, which gives you point-in-time recovery.
  • Rolling updates. It updates standbys first, then switches over or restarts the primary, so the write outage is one failover rather than a full restart.

The topology to aim for is a primary in zone A and a standby in zone B. Both send WAL to the same bucket, which sits outside either zone.

Your team keeps the rest:

  • Kubernetes cluster upgrades
  • Storage class choice and its IOPS and latency behavior
  • Node sizing
  • Postgres tuning
  • Restore testing
  • On-call response

The operator also couples your database to the cluster. Database availability now depends on Kubernetes health and on your upgrade schedule. A pod disruption budget that doesn't fit the instance count can either block node drains or allow a drain to evict the primary at a bad time. Volumes tied to a single zone are the most serious risk. During a node loss or zone outage, a volume that won't detach, or that can't attach anywhere else, can stretch a routine failover into a long incident.

apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
  name: pg-main
spec:
  instances: 2                    # one primary + one standby
  affinity:
    enablePodAntiAffinity: true
    topologyKey: topology.kubernetes.io/zone   # spread instances across zones
  storage:
    storageClass: fast-ssd        # your choice: IOPS, latency, zone binding
    size: 100Gi
  backup:
    retentionPolicy: "14d"
    barmanObjectStore:            # continuous WAL archiving + base backups
      destinationPath: s3://example-pg-backups/pg-main
      s3Credentials:
        accessKeyId:
          name: pg-backup-creds   # Secret you create; never inline keys
          key: ACCESS_KEY_ID
        secretAccessKey:
          name: pg-backup-creds
          key: ACCESS_SECRET_KEY
      wal:
        compression: gzip
---
apiVersion: postgresql.cnpg.io/v1
kind: ScheduledBackup
metadata:
  name: pg-main-nightly
spec:
  schedule: "0 0 2 * * *"        # six fields, seconds first: daily at 02:00
  cluster:
    name: pg-main

A minimal CloudNativePG Cluster with two instances in separate zones, per-instance persistent storage, WAL archiving to an object storage bucket, and a nightly base backup. Newer operator releases move object storage backups to the Barman Cloud plugin, so check which method your version expects.

Illustrative estimate: one HA database, priced both ways

The ops-hours column, not the instance price, usually decides the comparison.

Illustrative estimate (assumed numbers, not a benchmark)

Assumed setup: one primary plus one synchronous standby in a second zone, each with 4 vCPU, 16 GiB RAM and 500 GiB of storage, plus backups kept in object storage. Every figure below is an assumption chosen to make the arithmetic easy to follow. None are quoted prices or measurements. The assumed loaded engineer cost is $100/hour.

Monthly total = compute + storage + backup storage + (ops hours × loaded hourly rate)

Bucket (assumed, per month) Managed Postgres CloudNativePG on Kubernetes
Compute, both nodes $1,100 $500 (includes share of node overhead)
Storage, both nodes $300 $200
Backup storage $50 $50
Ops hours × $100 4 h = $400 12 h = $1,200
Total $1,850 $1,950

Self-hosting saves $700/month on infrastructure in this example. That saving pays for 7 extra engineer-hours, so the break-even point is self-hosted ops hours = managed ops hours + 7:

  • At 8 self-hosted hours, CloudNativePG costs $1,550 and wins by $300.
  • At 11 hours, the two options tie.
  • At 20 hours, CloudNativePG costs $2,750, and a single bad failover month can produce that.

The result depends on a few hours of work per month, so the infrastructure prices are the least important inputs. Replace the ops-hours figures with numbers from your own incident tickets, on-call pages, upgrade work and restore drills. Teams usually estimate from a quiet month and leave out the incident months, which makes self-hosting look cheaper than it is.

How many databases before self-hosting breaks even?

The two options scale differently. A managed service charges roughly per instance, so cost grows in a straight line from the first database. Self-hosting starts with a large fixed cost: building the platform, writing runbooks, and building expertise. After that, each extra cluster costs less. Break-even is the fleet size where the two lines cross:

N = F / (M − S)

Here F is the monthly fixed platform cost, M is the monthly managed cost per database, and S is the monthly self-hosted marginal cost per database, including engineer time.

Illustrative estimate, assumed inputs: F = $15,000 (roughly 0.75 of an engineer kept on the platform), M = $2,000, S = $900. The result is N = 15,000 / 1,100 ≈ 14 databases.

HA databases Managed (monthly) Self-hosted (monthly)
2 $4,000 $16,800
5 $10,000 $19,500
14 $28,000 $27,600
30 $60,000 $42,000
60 $120,000 $69,000

A team with a few databases sits at the top of this table. It pays nearly the full F for a platform it barely uses, and the savings on each instance never cover that cost.

Large fleets run by a mature platform team can recover F. That only holds if the team keeps paying it. If restore drills and major-version upgrades get cut to protect the margin, F shrinks on paper while the risk grows.

The formula also treats F as a smooth number. In practice, F is often one or two engineers who understand the operator and the failure modes. If one of them leaves, you have to rebuild that knowledge at short notice, and the spreadsheet has no row for that cost.

import math

F = 15_000  # monthly fixed platform cost (about 0.75 of an engineer)
M = 2_000   # monthly managed cost per HA database
S = 900     # monthly self-hosted marginal cost per database, incl. engineer time

def managed(n: int) -> int:
    # Managed cost is a straight line from the first database.
    return M * n

def self_hosted(n: int) -> int:
    # Self-hosting pays F up front, then less per extra cluster.
    return F + S * n

def break_even() -> int | None:
    # The lines cross only if each self-hosted database is cheaper.
    if M <= S:
        return None  # self-hosting never recovers F
    # Round up to the first whole database where self-hosting is cheaper.
    return math.ceil(F / (M - S))

print(f"Break-even: {break_even()} databases (F / (M - S) = {F / (M - S):.2f})")
print(f"{'HA DBs':>6} {'Managed':>10} {'Self-hosted':>12} {'Cheaper':>12}")
for n in (2, 5, 14, 30, 60):
    m, s = managed(n), self_hosted(n)
    cheaper = "self-hosted" if s < m else "managed"
    print(f"{n:>6} {m:>10,} {s:>12,} {cheaper:>12}")

A small Python model that applies N = F / (M − S) to the illustrative inputs and reproduces the cost table. It shows that self-hosting only becomes cheaper at about 14 databases.

What hidden costs show up on each side?

Most of these items never appear on a pricing calculator. They show up later on the bill or as engineering hours.

Hidden cost Managed Postgres Self-hosted (CloudNativePG)
Cross-zone traffic The provider often does not bill its own standby replication separately. Application pods reading from a primary in another zone usually are billed. Streaming replication between zones is billed as inter-zone transfer, on top of any application traffic.
Backups Retention beyond the included allowance, plus manual snapshots kept "just in case," grows quietly. Object storage for base backups and WAL archives. The cost scales with write volume, not database size.
Storage Autoscaling grows volumes but typically cannot shrink them. Faster performance tiers or provisioned IOPS are billed whether you use them or not. Your CSI driver may not support online resize or snapshots, or may support them with caveats. You find this out during an incident.
Compute Instances sized for a past peak stay large, because resizing means a failover window someone has to schedule. Each node needs headroom so a failed-over pod can reschedule, and anti-affinity rules spread pods across nodes. That capacity sits mostly idle.
Replicas Each read replica is billed as a full instance. Replicas are cheaper per unit but still need their own nodes and volumes.
Observability Basic metrics are included. Deeper query insight is often an add-on. You run Prometheus-style metrics, alerting, dashboards and log retention yourself.
Exit cost Migrating off requires logical replication or a dump-and-restore, a period of running both systems, and egress charges. Moving between clusters is still work, but your tooling and data format move with you.

How do you price recovery and prove restores work?

Start by setting two targets, because they determine what recovery costs. The recovery point objective (RPO) is how much data you can afford to lose. The recovery time objective (RTO) is how long you can be down. Together they set your WAL archiving cadence, backup retention, and how fast a restore must finish.

On managed Postgres, a drill is a point-in-time restore to a new instance at a chosen timestamp. The restore always creates a separate instance, so the drill also tests the parts teams tend to forget: parameter settings, network access rules, and repointing connection strings.

On CloudNativePG, a drill means creating a new Cluster that bootstraps from the object storage backup and replays WAL up to a target time. This tests whether the bucket credentials still work, whether the WAL archive has gaps, and whether the storage class can hold the restored data.

Verify both kinds of drill the same way:

  • Compare row counts on critical tables against known values.
  • Confirm that the latest commit or updated_at timestamp falls just before the target time.
  • Run the application's smoke queries.
  • Record the elapsed time against your RTO.

Illustrative estimate. Assume one drill per month and a loaded engineering cost of $100 per hour:

Option Hours per drill (assumed) Hours per year Cost per year
Managed Postgres 2 24 $2,400
CloudNativePG 4, including fixes 48 $4,800

Add these figures to the cost model as a recurring line item.

If you skip the drills, the self-hosted option looks cheaper, but you have not saved anything. An untested self-hosted backup is an unpriced liability that you discover during an outage.

-- Restore drill verification. Run against the NEW restored instance or cluster,
-- never against production. Target time for this drill: 2026-11-09 14:00:00+00.

-- 1. Recovery state. After promotion, the replay timestamp stays fixed at the
--    last transaction applied during recovery. It should fall just before the target.
SELECT pg_is_in_recovery()             AS still_in_recovery,
       pg_last_xact_replay_timestamp() AS last_replayed_commit;

-- 2. Row counts on critical tables, compared with values captured from
--    production at the target time. Replace the expected numbers with your own.
SELECT 'orders' AS table_name, count(*) AS actual, 1250000 AS expected FROM orders
UNION ALL
SELECT 'payments', count(*), 980000 FROM payments
UNION ALL
SELECT 'customers', count(*), 310000 FROM customers;

-- 3. Application-level freshness. The newest write should be close to the
--    target time and never after it.
SELECT max(updated_at)                                        AS newest_write,
       max(updated_at) <= timestamptz '2026-11-09 14:00:00+00' AS not_past_target,
       timestamptz '2026-11-09 14:00:00+00' - max(updated_at)  AS gap_to_target
FROM orders;

-- 4. Record the result for the cost model and the RTO check.
--    elapsed = time the restored instance accepted queries - time the drill started.
CREATE TABLE IF NOT EXISTS restore_drill_log (
  drill_date    date        NOT NULL,
  target_time   timestamptz NOT NULL,
  elapsed       interval    NOT NULL,
  rto_target    interval    NOT NULL,
  checks_passed boolean     NOT NULL,
  notes         text
);
-- Keep this log outside the restored instance, or export it, because the
-- restored instance is usually deleted after the drill.
INSERT INTO restore_drill_log VALUES
  ('2026-11-10', '2026-11-09 14:00:00+00', interval '47 minutes',
   interval '1 hour', true, 'counts matched; WAL replay reached target');

A verification script for the restored instance in either option. It checks the recovery replay timestamp, critical-table row counts and the newest write against the target time, then records elapsed time against the RTO.

When should you use managed Postgres, and when should you self-host?

Use managed Postgres when:

  • You run a small number of databases. Below the break-even fleet size, the fixed platform cost of self-hosting is never recovered.
  • Your team has no production experience running stateful workloads on Kubernetes. The operator automates database failover, but it cannot debug a volume that will not attach.
  • On-call is thin. If one or two people would carry every database page, the provider's operations team is the cheaper backstop.
  • Auditors expect provider attestations for encryption, backup retention and physical security, and you do not want to produce that evidence yourself.
  • The workload fits inside the managed service's limits on extensions, superuser access and tunable parameters.

Use CloudNativePG (or another self-hosted model) when:

  • You already operate Kubernetes in production with a platform team that owns storage, upgrades and node lifecycle.
  • You run many databases, especially many small ones, so the fixed cost is spread across the fleet.
  • You need control the managed service does not give you: specific extensions, superuser access, kernel or storage-layout tuning, or a particular major version on your own schedule.
  • You need fast, cheap, disposable databases for development, CI and preview environments, where provisioning speed matters more than a provider's uptime commitment.
  • Portability matters, for example running the same database setup across several clouds or on-premises clusters.

If your situation matches both lists, that usually points to the hybrid model described below rather than a single choice for every database.

Should you use managed Postgres or CloudNativePG? A decision checklist

The questions below decide which option's hidden costs your team will eventually pay for during an incident.

Work through these questions before choosing:

  • Kubernetes maturity and on-call: Do you already run stateful workloads in production? Is there an on-call engineer who can debug a stuck volume attachment or a failed failover? If not, the operator moves the problem somewhere else and adds a skill gap.
  • Number and size of databases: Many small databases spread the fixed platform cost. A few large, write-heavy databases gain the most from managed storage and support.
  • Compliance and audit: Can you produce your own evidence for encryption, backup retention and access control? Without that, you depend on the provider's attestations.
  • Extensions and superuser: Do you need extensions, settings or superuser access that the managed service blocks?
  • Storage-layer failures: Are you prepared to own disk corruption, full volumes and zone loss end to end?

CloudNativePG on an existing platform is the better choice when the first answer is a confident yes, the database count is high, and you need control that the managed service will not give you. Avoid it if Kubernetes is new to the team, one person carries on-call, or auditors expect provider attestations.

Option Saves engineering time on Consumes engineering time on
Managed service Patching, failover, backups Working within its restrictions, cost reviews
Self-managed on VMs Kubernetes complexity Everything else, done by hand
CloudNativePG Fast provisioning of dev and preview databases Storage, upgrades, restore drills
Hybrid Critical databases stay managed, low-tier databases are cheap Running and documenting two operating models

For most teams, the hybrid option is the lowest-risk way to start. Developers get cheap databases from the operator, and production stays on a service you do not have to page anyone for.

What are the alternatives?

Managed Postgres and CloudNativePG are two points on a wider range. The cost model in this article applies to each of them: price the infrastructure, then price the hours.

  • Self-managed Postgres on virtual machines. You install Postgres on VMs, configure streaming replication yourself, and add open-source tooling for failover, connection routing and backups. This removes Kubernetes from the failure surface, which some teams find easier to reason about for a few large databases. It also removes the declarative reconciliation an operator gives you, so provisioning, failover testing and upgrades become runbooks and scripts that you maintain.
  • Other Kubernetes operators for Postgres. CloudNativePG is not the only operator. Others differ in how they handle replication, backup tooling, connection pooling and upgrades. The cost structure is the same: a fixed platform cost plus per-cluster storage and engineer time. Compare them on how failover and restore actually behave in your cluster, not on feature lists.
  • Other managed Postgres offerings. Most cloud providers and several database vendors offer managed Postgres, including variants with storage layers that are separate from compute and serverless options that scale or pause with load. Pricing models vary, for example per instance-hour, per unit of consumed capacity, or per stored and transferred gigabyte, so recompute M in the break-even formula for each one rather than assuming it matches the service you priced first.
  • Hybrid. Keep critical production databases on a managed service and run development, CI, preview and low-tier internal databases on an operator. You pay for two operating models, but each database goes to the model whose costs suit it.
  • Consolidation. Before choosing either option, check whether several small databases can share one cluster as separate databases or schemas. Fewer clusters lower the managed bill and the self-hosted per-cluster cost alike, at the price of shared failure domains and noisier neighbors.

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 rds vs self-hosted postgres 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.
  • Reviewers see the exact diff and the list of affected services up front, so approval is a decision rather than an investigation.

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.
  • Per-service approve/reject means a bad shared value can be refused where it would break something, before it is live.
  • 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.