Home›Operate›Where to run the database
Designs · where to run it

Where to run the database

On-prem, a managed cloud service, EC2, or Kubernetes?

You will learn: the seven ways to run a database, who does which job in each, how to compare the full cost including people, and where I would run each of the fourteen applications in the design docs.

The engine decides how the data behaves. Where it runs decides who gets paged, what you are allowed to change, and what the bill looks like. None of these options changes the physics on the rest of this site: a commit still waits for the log, and a long transaction still bloats the table. They change who owns the work around it. For the engine-by-engine detail, see On-prem vs cloud.

Start here

Where should it run?

Four questions. The answer is a starting point for the discussion, with the reason and what stays yours.

1. Who will run the database day to day?
2. Where do the applications run?
3. Any hard constraint?
4. What does the load look like?
Seven options

What each one is, and when it fits

On-prem or bare metal

Your servers, in your data center or a colocation facility.

Pick it when
Data must stay in your own facilities, or a regulator says so. The load is large and steady, and you already have the data center, the hardware team and the DBAs. The applications run there too.
Avoid it when
You have no one to answer a 3 a.m. disk failure. The load is small, new or unpredictable. You need capacity in days, not months.
You still own
Everything: hardware, spares, the OS, the engine, backups, failover, monitoring, and the people for all of it.
Cost shape
Large up-front purchases, spread over three to five years, plus space, power and people. Cheapest per unit at a large, steady load, and the most expensive when hardware sits idle.

Self-managed on VMs: EC2, Compute Engine, Azure VMs

The same engine you would install on-prem, on a rented virtual machine.

Pick it when
You need what managed services do not allow: OS access, an extension they do not list, a specific version, a custom build, file-level tools. Or the load is large and steady, and you have the people to run it, and the bill comparison favors it.
Avoid it when
Nobody on the team wants to own backups, failover and patching. The database is small, so the people cost dwarfs the savings.
You still own
The OS, the engine, backups and restore tests, replication and failover (Patroni, Orchestrator or a runbook), monitoring. The provider owns the hardware.
Cost shape
An hourly VM plus block storage. On AWS, a gp3 volume includes 3,000 IOPS and 125 MiB/s, and more costs extra, up to 80,000 IOPS and 2,000 MiB/s per volume. io2 is for workloads that need lower, steadier latency. Reserved terms lower the price of a steady VM.

Managed relational: RDS, Cloud SQL, Azure Database

The provider runs the engine for you. You get an endpoint, not a server.

Pick it when
Most applications, most of the time. A small team, or a team that should spend its time on schema and queries rather than on patching and failover.
Avoid it when
You need superuser, OS access, unlisted extensions or file-level tools. The load is very large and steady, and a careful comparison shows self-managed is much cheaper for you.
You still own
Schema, indexes, queries, parameter choices inside what the provider allows, connection pooling, restore tests, upgrade testing, and the bill.
Cost shape
An hourly instance, storage, I/O on some services, backups past the free amount, and a standby billed like a second instance. On RDS, a Multi-AZ DB instance replicates synchronously to a standby in another zone. That standby cannot serve reads.

Cloud-native managed: Aurora, AlloyDB

Managed engines whose storage layer was rebuilt for the cloud. Compute and storage are separate.

Pick it when
You want fast failover, many read replicas sharing one copy of the storage, and storage that grows on its own. Read-heavy workloads at scale.
Avoid it when
Write throughput beyond one writer, which these still have. I/O-heavy workloads on a pricing model that charges per I/O, unless you pick the option that does not.
You still own
The same as managed: schema, queries, parameters, pooling, the bill.
Cost shape
Instance plus storage, and depending on the configuration, I/O. Compare both pricing options on your own workload.

Serverless: Aurora Serverless v2, Neon and similar

Capacity that scales up and down with the load, sometimes to zero when idle.

Pick it when
Development and test databases, and spiky or rarely used workloads. Many small databases that are idle most of the day.
Avoid it when
An always-on, latency-sensitive service. On recent engine versions (Aurora MySQL 3.08 and later, Aurora PostgreSQL 13.15, 14.12, 15.7 and 16.3 and later), setting minimum capacity to 0 ACUs lets Aurora Serverless v2 pause at zero capacity, but the first connection then waits about 15 seconds while it resumes, and longer after a day of sleep. Open idle connections stop it from pausing at all.
You still own
The same as managed, plus timeouts and retries in the application for the resume.
Cost shape
Billed by capacity units per second. Storage is billed while paused. Cheap when idle, and it can cost more than a fixed instance under steady load.

Vendor database services: Atlas, ElastiCache and MemoryDB, ClickHouse Cloud, Keyspaces and Astra

The non-relational stores in the design docs, run by their vendor or the cloud provider.

Pick it when
You need MongoDB, Redis or Valkey, ClickHouse or Cassandra, and nobody on the team has run them in production.
Avoid it when
You need features the service does not offer, or the bill at your scale is far above running it yourself, and you have the people.
You still own
Data modeling, keys and partitions, queries, sizing, and the bill. The engine's rules still apply: a hot partition in Cassandra is still hot in a managed service.
Cost shape
Varies by vendor: instance-based, capacity-unit, or per-request pricing. Per-request pricing is cheap at low volume and expensive at high, steady volume.

Kubernetes with an operator

The database runs in pods, declared in YAML, and an operator (CloudNativePG, Percona, Oracle MySQL, MongoDB) handles failover and backups.

Pick it when
Your applications already run on Kubernetes, a platform team runs it well, and you want many small or medium databases created the same way as everything else. Dev and test environments on demand.
Avoid it when
One large, critical database and no one who knows both Kubernetes and the database engine deeply. When something breaks, the on-call engineer has to debug both at once.
You still own
The cluster spec, storage classes, backups to a bucket, anti-affinity across zones, disruption budgets, version upgrades, and all the same tuning as anywhere else.
Cost shape
Nodes and volumes, plus the people who run the platform. Cheap per database when you run many, since they share the platform.
Who does what

The jobs do not disappear. They move.

Who owns each job

Read across a row to see where a job moves. Restore tests and the schema stay yours in every column.

YouProviderOperator or platform team
On-premVMs (EC2)ManagedKubernetesHardwareHardware, On-prem: YouYouHardware, VMs (EC2): ProviderProviderHardware, Managed: ProviderProviderHardware, Kubernetes: Platform teamPlatform teamOS patchingOS patching, On-prem: YouYouOS patching, VMs (EC2): YouYouOS patching, Managed: ProviderProviderOS patching, Kubernetes: Platform teamPlatform teamEngine upgradesEngine upgrades, On-prem: YouYouEngine upgrades, VMs (EC2): YouYouEngine upgrades, Managed: ProviderProviderEngine upgrades, Kubernetes: OperatorOperatorBackupsBackups, On-prem: YouYouBackups, VMs (EC2): YouYouBackups, Managed: ProviderProviderBackups, Kubernetes: OperatorOperatorRestore testsRestore tests, On-prem: YouYouRestore tests, VMs (EC2): YouYouRestore tests, Managed: YouYouRestore tests, Kubernetes: YouYouFailoverFailover, On-prem: YouYouFailover, VMs (EC2): YouYouFailover, Managed: ProviderProviderFailover, Kubernetes: OperatorOperatorMonitoringMonitoring, On-prem: YouYouMonitoring, VMs (EC2): YouYouMonitoring, Managed: SharedSharedMonitoring, Kubernetes: YouYouTuningTuning, On-prem: YouYouTuning, VMs (EC2): YouYouTuning, Managed: SharedSharedTuning, Kubernetes: YouYouSchema and queriesSchema and queries, On-prem: YouYouSchema and queries, VMs (EC2): YouYouSchema and queries, Managed: YouYouSchema and queries, Kubernetes: YouYou
JobOn-premVMs (EC2)ManagedKubernetes
Hardware and data centerYouProviderProviderProvider, or your platform team on-prem
OS patchingYouYouProviderPlatform team (nodes) and the image (engine)
Engine minor upgradesYouYouProvider, in a window you chooseYou change the image, the operator rolls it
Major version upgradesYouYouYou plan and test, the provider runs itYou, with operator support that varies
BackupsYou build themYou build them, plus disk snapshotsProvider, automated, with point-in-time recoveryThe operator, to a bucket you configure
Restore testsYouYouYouYou
FailoverYou: Patroni, Orchestrator or a runbookYou, the same wayProviderThe operator
MonitoringYouYouProvider metrics, plus your alertsYou: Prometheus and dashboards
TuningEvery settingEvery settingInside what the provider allowsIn the cluster spec
Schema, indexes, queriesYouYouYouYou
Capacity and the billYou buy aheadYou resizeYou pick sizes; storage can growYou size nodes and volumes

Restore tests and the schema are yours in every column. That is the part of the job no provider takes.

The full cost

The bill plus the people

Comparing only the invoices favors self-managing every time, because the people cost is not on them. Put both in.

The numbers below are an example, not prices. Replace the monthly bills with quotes from your provider's calculator and your hardware vendor, and the hours with your team's estimate.

Kubernetes, honestly

When databases on Kubernetes work, and when they hurt

  1. Storage decides everythingNetwork volumes survive a node loss and move with the pod, at the cost of latency on every commit. Local NVMe volumes are fast but tie the pod to one node, so the operator's replicas become your durability. Know which one your storage class gives you.
  2. Spread the replicasAnti-affinity across nodes and zones, so one node or zone failure cannot take the primary and its standby together.
  3. Protect it from the platformPod disruption budgets, so a node drain during a cluster upgrade does not stop the primary and a replica at once.
  4. Pick a mature operator and read its limitsBackups, failover and upgrades are only as good as the operator. Some features are marked preview. The On-prem vs cloud page lists the operators I verified for each engine.
  5. Make sure on-call can debug both layersA failover that does not happen might be the database, the operator, the network or the storage. One person needs to know all four.
Self-managed on EC2

Storage choices that decide performance

  1. gp3 for most databases3,000 IOPS and 125 MiB/s are included at any size. You can buy more independently of size, up to 80,000 IOPS and 2,000 MiB/s per volume. It does not burst, so what you buy is what you get all day.
  2. io2 Block Express for latency-sensitive commitsAWS designs it for an average latency under 500 microseconds for 16 KiB I/O, with fewer slow outliers than gp3. Every commit waits for a log write, so this shows up directly in commit latency.
  3. Instance store NVMe only with replicasVery fast, but the data is lost when the instance stops or its host fails. Use it only where another replica holds the data, as in Cassandra or a replicated cluster with automated rebuilds.
  4. Snapshots are not your only backupA disk snapshot is crash-consistent at best. Keep an engine-level backup and a log archive for point-in-time recovery, and test restoring both.

How much one commit costs on a cloud disk: Notebook 2.

By application

Where I would run each design

For a team without a dedicated database team, which is most teams. With a strong DBA or platform team and a large, steady load, the self-managed options move up.

ApplicationWhere I would startWhen it grows
Online store: orders and inventoryManaged relational with a standby in another zoneCloud-native managed (Aurora, AlloyDB) for read replicas, or self-managed on VMs if the steady bill justifies a team
Payments and ledgersManaged relational with synchronous standby (RDS Multi-AZ or equivalent)The same, plus cross-region copies. Self-managed only with a team that rehearses failover
Bookings and reservationsManaged relational, plus a managed queue for on-salesThe same. The spike is handled by the queue, not by a bigger database
User accounts, logins and sessionsManaged relational, plus managed Redis or ValkeyThe same
Multi-tenant SaaSManaged relational, shared schemaManaged for the shared tier. Kubernetes with an operator, or many managed instances, for tenants that get their own database
Product catalogManaged relational, plus a managed search serviceThe same, with a CDN in front
Social feed and timelinesManaged relational, plus managed RedisManaged or self-managed wide-column store on VMs with local NVMe and replicas
Search and AI retrievalManaged PostgreSQL with pgvectorA managed search or vector service once the index outgrows memory
Chat and messagingManaged relational with time partitionsManaged Cassandra-compatible service, or self-managed Cassandra or ScyllaDB on VMs
IoT, metrics and telemetryA managed time-series or ClickHouse serviceSelf-managed on VMs when volume is high and steady, and storage cost dominates
Audit logs and event historyIn the same managed database as the actionOld partitions exported to object storage
Leaderboards, counters and rate limitsManaged Redis or ValkeyThe same. MemoryDB-style durable options if the totals must survive a failover
Analytics and reportingA managed warehouse or ClickHouse Cloud, fed by CDCThe same. Self-managed ClickHouse on VMs if scan costs are high and the team exists
Agent memory and stateManaged PostgreSQL with pgvector, plus managed Redis or ValkeyA pooler in front when it grows; a dedicated vector service only once the memory index outgrows one machine's memory
SourcesProduct facts on this page were checked against provider documentation on Nov 18, 2026: EBS gp3 volumes, RDS Multi-AZ DB instances, Aurora Serverless v2 auto-pause. Prices are not quoted on purpose: they change, and they differ by region and provider.
Connected

Where this shows up

The same mechanism, replication and failover, backups and restore, elsewhere on the site: in real incidents, in measurements, and in designs.

Check yourself · 3 questions

Check yourself

Pick an answer. You will see whether it is right, and why.

1. Which job stays yours in every option, including managed?

2. Can the standby of an RDS Multi-AZ DB instance serve reads?

3. An Aurora Serverless v2 database paused at zero capacity. What does the first connection see?

Part 4 of 4 · Operate · 15 pagesAll pages

How do I run it in production? What to check when it is slow or broken, where it runs and what it costs, how big it must be, pooling, backups, security, upgrades and other changes made safely.