Why a self-hosted Medplum backup needs a tested restore
A self-hosted Medplum backup is only useful if you can restore it, and proving that is your job. Back up the PostgreSQL database, the binary storage that holds attachments and other binary content, and the configuration that makes the stack run, then schedule restore drills that show those three parts come back together. If you run Medplum in your own cloud account, data loss or a failed upgrade is both a patient safety issue and a compliance issue, so the backup plan has to be designed and tested before you need it.
Medplum's compliance documentation states that compliance is a shared responsibility between Medplum and its customers. When you self-host, the infrastructure, database, storage and backup routines sit in your account, so the evidence that backups run, that they are encrypted and retained, and that restores have been tested is yours to produce for your auditors and security reviewers. Medplum's compliance documentation is the right starting point for mapping which controls are yours. Ask your team to confirm exactly which responsibilities Medplum's documentation assigns to the vendor and which fall to your organization before you scope the work.
Start with three questions. Which PostgreSQL recovery method will you use, and does it support point-in-time recovery to a chosen moment? Where does binary storage live, and is it included in the same recovery point as the database? Which configuration, secrets and infrastructure definitions are needed to rebuild the stack in a clean environment? Record the answers, run a restore into a separate environment on a fixed schedule, and keep the results as dated evidence. A restore drill that has never been run is a hope, not a control.
How the backup components fit together
The Medplum server writes its relational data to the PostgreSQL primary, which ships WAL segments to an archive and takes periodic base backups. Binary content such as attachments lives in separate binary storage that needs its own copy, and configuration and secrets sit in a store outside the database. Copies that leave the customer's cloud account form a separate trust boundary, so check who holds the keys and access to each copy. A restore drill should rebuild the server and database in a clean target, then confirm that data, binaries and secrets all reconnect.
Data flows from the primary and binary store into archives, then to a restore target.
What a Medplum backup must include
A Medplum backup is only as complete as its inventory, and the inventory has five data classes. PostgreSQL is the system of record: clinical resources, projects, access policies, users, Bots and audit-relevant history live there, so the database backup is the part that cannot be rebuilt. Redis is the cache and should be treated as disposable. Medplum uses Redis as its cache, so a restore plan should rebuild it from empty rather than spend effort capturing it. Confirm with the self-hosting docs that no state you care about is held only in Redis for your release.
Binary resources such as attachments, images and documents are the second class, and where they live depends on the storage backend you chose at install time. If binaries sit in object storage, the bucket needs its own versioning, replication or backup policy, and a database restore alone will leave references pointing at missing objects. If the storage backend is local to the host, the volume must be captured on a schedule that matches the database. Confirm the backend and its backup behavior against the Medplum self-hosting docs before you write the policy.
The third and fourth classes are server configuration and the secrets that run it: environment settings, the database and Redis endpoints, signing keys, and integration credentials. Keep these out of the database backup and store them in a secrets manager with its own recovery path, so a restored database cannot be opened without the keys that match it. The fifth class is the infrastructure code (CDK, CloudFormation, Terraform, Helm or Kubernetes manifests) and the container image version. Record the exact Medplum version alongside each backup, because a restore into a different minor version must follow the upgrade rules. Write down this artifact list for your deployment and have the team sign it off before any restore drill is scheduled.
Choosing a PostgreSQL backup method
A physical base backup copies the whole PostgreSQL data directory, and continuous archiving ships the write-ahead log (WAL) segments generated after that copy. Together they let you restore to a chosen moment between backups, which is the basis of point-in-time recovery (PITR) described in the PostgreSQL continuous archiving documentation. Recovery granularity is the finest of the three approaches, because it is limited by the last archived WAL segment rather than by the backup schedule.
- Recovery granularity: You can target a timestamp, transaction or named restore point, which matters when a bad bot or bulk import corrupts data hours after it started.
- Restore time drivers: Restore time grows with the size of the base backup, the number of WAL files to replay, and the throughput of your object storage.
- Archive integrity: A gap in archived WAL breaks the recovery chain, so monitor archive failures as closely as backup job failures.
- Upgrade interaction: Physical backups are tied to the major version that produced them, so a restore onto a newer major version requires a conversion step or a rebuild from a dump.
- Operational load: Retention, pruning old base backups and verifying archive continuity are ongoing tasks your team or partner owns.
Before you rely on this method, confirm that a restore into a clean host reaches a consistent state at a target time you chose in advance.
Logical dumps export schema and data as SQL or archive files, using pg_dump for one database or pg_dumpall for the whole cluster, including roles and global objects. The approach is simple to inspect and portable across major versions, which makes it a common complement to physical backups rather than a replacement for them. The PostgreSQL upgrading documentation lists pg_dumpall and restore as one of the supported routes for a major upgrade.
- Recovery granularity: A dump captures only the moment it was taken, so recovery point equals the last successful dump, typically a whole day or more of data loss unless paired with other methods.
- Restore time drivers: Restore time depends on data volume, index rebuilds and constraint checks, and on how many parallel jobs you can run, so large clusters can take a long time to load.
- Upgrade interaction: Dump and restore is the most version-tolerant route, and it is a natural path when moving to a new major PostgreSQL release.
- Consistency scope: Dumps made with
pg_dumpallcapture cluster-wide roles and settings, which helps when rebuilding a Medplum database host from scratch. - Use in drills: Dumps are easy to restore into a scratch database for regular verification, which makes them useful evidence even when the primary strategy is PITR.
Confirm the restore duration of your largest dump in a scratch environment, since that figure, not the dump duration, sets your practical recovery time.
When PostgreSQL runs on a managed cloud service, the provider usually offers automated snapshots and, often, point-in-time restore built on the same principles as base backups and WAL. Your responsibility shifts from running the backup tooling to configuring retention, copying snapshots to another region or account, and proving that restores work. The exact features, retention limits and restore mechanics depend on the provider, so confirm them in the provider's documentation before design work starts.
- Recovery granularity: Managed point-in-time restore often targets a timestamp inside the retention window, but confirm the granularity and any lag your provider documents.
- Restore time drivers: Restore creates a new instance, so provisioning time, instance class, storage size and any reconnection of application secrets all add to the total.
- Cross-region copies: Snapshot copies to another region or account are usually a separate setting and sometimes a separate cost, so check them against your disaster recovery goals.
- Upgrade interaction: Major version upgrades are typically performed through the provider's own process, so confirm how a snapshot taken before an upgrade can be restored.
- Shared responsibility: The provider secures the infrastructure, but your team still owns restore drills, access to snapshots and evidence of testing.
Ask the provider, or your own platform team, to show a full restore into a new instance with the same Medplum configuration you run in production.
Setting up backups and archiving
This sequence turns a self-hosted Medplum database and its binary storage into a backup set with continuous WAL archiving, scheduled base backups, bounded retention and access controls, and a written inventory of what is protected and how it is recovered.
Confirm the PostgreSQL version and support window
Record the PostgreSQL major and minor version your Medplum deployment runs and compare it with the published support dates. PostgreSQL 14 is listed as supported only until November 12, 2026, so a deployment on that version should plan an upgrade before backup procedures are built around it. Confirm the Medplum release line you run in the upgrade guide, because server upgrades and database upgrades are planned together. Done when you have a written version record and a dated upgrade decision that the backup design can reference.
Enable WAL archiving to a separate store
Configure PostgreSQL continuous archiving so that every completed write-ahead log segment is copied to a location outside the database host, such as object storage in a different account or failure domain. This is what makes point-in-time recovery possible. The database team sets the archive command and the platform team provisions the bucket or volume. Done when test segments appear in the archive location after a forced log switch and the archive directory on the primary no longer grows without bound.
Schedule regular base backups
Set up a scheduled base backup of the database cluster, using PostgreSQL's native base backup tooling or a backup tool your team already operates. Base backups give the restore starting point, and archived WAL carries the database forward from that point to a chosen moment. Choose a schedule that your recovery objectives justify, and record it. Done when a base backup has completed, its label and start time are logged, and a restore can be started from it in a test environment.
Back up binary storage and configuration alongside the database
Medplum binary data, such as attachments and uploaded files, lives in the storage backend you configured, and it is not captured by a database backup. Enable versioning or replication on that store or schedule its own backup. Export the server configuration, environment files, infrastructure as code, and container image references needed to rebuild the stack. Done when a database restore and a binary restore can both be matched to the same point in time, and the configuration export is stored with its own access controls.
Set retention and lifecycle rules
Define how long base backups and archived WAL are kept, and make sure no archived segment needed to reach a retained base backup is deleted early. Retention is set by your legal, clinical records and contractual requirements, so ask your compliance lead for the period rather than copying a default. Configure lifecycle rules in the backup store to expire data on that schedule. Done when a retention table is approved and a test shows that the oldest retained base backup still has a complete WAL chain to the present.
Encrypt and restrict access to backup stores
Enable encryption at rest on the backup location with keys held in your key management system, and enforce encryption in transit for every copy. Grant write access to the archive and backup jobs through dedicated service identities, and separate read and restore rights from delete rights so that one compromised credential cannot erase the history. Log access to the backup store. Done when a principal without restore rights cannot list or delete backups, and access logs record each restore and delete attempt.
Record the configuration and secrets inventory
Write an inventory that lists every item a restore needs: database credentials, Medplum server configuration keys, signing and encryption keys, Redis settings, storage bucket names, and the location of each backup set. Store the inventory in a controlled system, not beside the backups, and note who can retrieve each secret during an incident. Done when a second engineer can read the inventory and locate every secret and backup target without help from the original author.
Add checks that confirm archiving is succeeding
Create monitoring that alerts when archive commands fail, when the most recent archived segment is older than expected, when a base backup job does not finish, and when the backup store's size or object count changes abnormally. Route these alerts to the on-call team and test them by briefly breaking the archive target in a non-production environment. Done when a deliberate failure produces an alert within your agreed response process and the alert is logged as part of the backup evidence.
How to test restores so the evidence holds up
A backup only counts once a restore drill has proven it works, so the core practice is a scheduled restore drill run against an isolated environment. Pick a target point in time (for PostgreSQL, a base backup plus archived WAL restored to a timestamp, following the steps in the continuous archiving and point-in-time recovery documentation), restore into a network segment that cannot reach production systems, and start a Medplum server against that database and the restored binary storage. Record the restore start and finish times, the target timestamp, the Medplum server version and the configuration revision used. Those records are the first pieces of evidence an auditor will ask for.
Once the server is up, run a fixed smoke test set that proves the platform works, not just that the database loaded. Read a sample of known Patient, Observation and Encounter resources by ID, run a search that depends on the restored indexes, write a test resource and confirm it reads back, and download a binary attachment through its stored reference. Compare record counts and a few checksummed sample records with values captured before the drill, and note any resources created after the target timestamp that should be absent. Also confirm that the database role, secrets and Auth configuration used by the restored stack match what production expects, since a restore that works only with hand-edited settings is a gap. Write down every gap, its owner and a retest date.
The drill is only evidence if it follows a written schedule and runs again after change. Set the cadence in a runbook that names the operator, the reviewer, the acceptance criteria and where results are stored, and ask your team or partner to confirm how often the schedule runs against your recovery objectives. Repeat the drill after every Medplum server upgrade, after PostgreSQL minor or major upgrades, and after changes to storage, encryption, identity or infrastructure as code. Medplum's upgrading guide warns that data migrations can run for a long time, so a drill that restores the pre-upgrade state is also a rollback rehearsal. Keep each report with its timestamps, outcomes and open gaps so auditors can trace a finding to the fix.
Security and access controls for backup data
A backup of a Medplum deployment holds the same clinical data as production, often in more places and with looser controls. The cards below cover the decisions that keep backup copies as protected as the live system, and the checks that show those protections still hold during a restore.
Encryption at rest and in transit
Every backup copy of the PostgreSQL database, the binary storage bucket and the configuration should be encrypted at rest, and every transfer between the database, the storage service and the backup target should use encrypted connections. Confirm which keys encrypt each store, who controls them, and whether the same key protects production and backup copies. A copy that uses a key the restore team cannot reach is not a usable backup.
Archiving docsLeast-privilege access to backup stores
Limit read access to backup stores to the small group that performs restores, and separate the permission to write backups from the permission to read them. Confirm that application servers and general engineers cannot list or download full database dumps. Review these grants on a fixed schedule, because backup buckets tend to accumulate broad access over time.
Separating backup and production credentials
The credentials that write backups should not be the credentials that run the Medplum server, and neither should be able to delete backups. Keep the backup role, the restore role and the production database role distinct, and store each in its own secrets location. Test that a compromised application credential cannot reach or overwrite the backup store.
Handling PHI in non-production restores
Restore drills often run in a staging environment that has fewer controls than production, which makes it the most likely place for PHI to leak. Decide in advance whether drill restores use full clinical data, a de-identified extract, or a scoped subset, and document who may access the drill environment. Confirm that the drill environment is torn down after each test and that its logs are handled under the same rules as production.
Retention and deletion rules
Decide how long each backup type is kept, how far back point-in-time recovery must reach, and when copies are deleted. Retention must match your record-keeping obligations and your ability to restore to a point before an incident is discovered. Confirm that deletion is enforced automatically and recorded, and that deleted backups are not still held in replicas or cold storage that nobody reviews.
Tamper protection for logs
Backup jobs, restore runs and access to backup stores should write audit records that the people operating those systems cannot alter. Send these logs to a separate destination with write-once or restricted deletion, and review them on a schedule. Ask your team to confirm how the logs are protected and who can change the retention settings on them.
Backup options and when each fits
This table compares the main ways to back up the PostgreSQL database behind a self-hosted Medplum deployment, along with the object storage and configuration that sit beside it. Read each row against your recovery point target, your upgrade calendar and the staff you have to run restores. Point-in-time recovery is the usual baseline, and the other options usually complement it rather than replace it.
| Option | Recovery granularity | Operational effort | Fit with major upgrades | Main trade-off |
|---|---|---|---|---|
| Base backup with WAL archiving (point-in-time recovery) | Any moment within the archived WAL window, down to the last archived segment | Moderate: archive storage, retention and regular restore drills must be configured and owned | Good for rollback: restore to a point before the upgrade, but the archive must match the server version used | Restores replay WAL, so restore time grows with the amount of WAL to apply |
| Logical dump (pg_dumpall or pg_dump) | Whole cluster or single database at the time of the dump | Low to set up, but large databases make dumps and restores slow | Strong for major version moves, since dumps restore into a newer server | Point-in-time loss equals the time since the last dump; Medplum data sets can make restores long |
| Managed database snapshots | Snapshot times set by the provider's schedule, plus any point-in-time option the service offers | Low day to day, but you must confirm retention, cross-region copy and restore steps with the provider | Depends on the service; confirm whether snapshots can restore into a different major version | Recovery is tied to the provider's tooling and account, which matters for portability and evidence |
| Replica-based recovery (hot standby or delayed replica) | Near-current on a streaming standby, but a standby copies mistakes such as accidental deletes | Higher: replication, monitoring and failover tooling must be run and tested | Useful for logical replication cutovers, which allow major upgrades with only several seconds of downtime per PostgreSQL documentation | A standby is not a backup on its own; pair it with a backup that can roll back bad writes |
| Object storage for Medplum binaries | Per object, versioned or copied on a schedule if you enable it | Low to moderate: versioning, replication and lifecycle rules must be set and checked | Not tied to the database version, so it survives PostgreSQL upgrades | Binary data and database rows can drift apart unless both are restored to matching points |
| Configuration and infrastructure as code | Version-level: the state of the repository at a given commit | Low when kept in version control with secrets stored separately | Needs the Medplum server version recorded alongside it to match the schema | Does not capture secrets, data or runtime state, so restore drills must include those separately |
Limits to confirm in your environment
A restore plan is only as good as the assumptions behind it. The cards below list the facts to pin down for your own Medplum and PostgreSQL versions, hosting platform and data volume before you commit to a backup schedule or a recovery target.
Exact Medplum and PostgreSQL versions
Record the exact Medplum server version and the PostgreSQL major version in your deployment, then check both against their support windows. Medplum supports each major version for a fixed period, with security patches for a limited time under its Enterprise extension, and PostgreSQL 14 is listed as supported only until November 12, 2026. A backup taken from an unsupported database version may still be restorable, but it leaves you with a harder upgrade path during a recovery. Confirm the upgrade order before you rely on a restore target.
Medplum versions policyBackup tool behavior on your platform
Confirm how your hosting platform takes database snapshots and archives write-ahead logs. Managed PostgreSQL services, Kubernetes operators and self-managed VMs each handle snapshot consistency, retention and point-in-time recovery differently. Ask whether snapshots are crash-consistent or application-consistent, how long archived logs are kept, and whether a restore creates a new instance or overwrites the existing one.
PostgreSQL archiving docsRestore time for your data volume
Restore duration grows with database size, index rebuilds and the number of archived logs to replay. Measure it on a copy of production data rather than estimating it from the snapshot size. Time the full path, including provisioning the new database, restoring the base backup, replaying logs to your target time and starting the application. That measured figure, not the backup window, determines whether your recovery target is realistic.
Binary storage location and backup scope
Medplum stores binary content such as attachments and uploaded documents outside the relational data path, so a database restore alone does not recover them. Confirm where binaries live in your deployment, whether that is object storage or another location, and whether that store has its own versioning, replication and retention settings. Check that the binary backup and the database backup can be restored to the same point in time, or the two will disagree about which files exist.
Migrations and upgrades that block rollback
Medplum requires upgrades through each minor version in sequence, and post-deploy data migrations can run for hours or days on large datasets. Once a migration has rewritten data, restoring the previous application image may not be enough to return to the old state. Confirm which upgrade steps are reversible, take a fresh backup immediately before each upgrade, and decide whether rollback means restoring the database or running the older version against the new schema.
Medplum upgrade guideBackup and restore questions buyers ask
What does backup work for a self-hosted Medplum deployment cost?
Cost depends on the scope of work you buy and on what your own team already runs. Backup work usually has a one-time part (designing the backup scheme, configuring PostgreSQL archiving, setting up binary storage replication, writing the restore runbook) and a recurring part (monitoring backup jobs, storing and retaining copies, running drills, and updating the runbook after each Medplum upgrade). The main drivers are the number of environments, the database size and change rate, how many retention tiers you need, whether backups must stay in a specific region or account, and how much of the storage and monitoring you already operate. Ask any quote to separate one-time setup from recurring operations, and to name who pays for storage capacity: your cloud account or a managed service line item.
How long does a Medplum restore drill take to plan and run?
The duration depends mainly on database size, the restore method you choose, and how much of the environment must be rebuilt during the drill. Planning covers agreeing the recovery targets you need to prove, choosing a restore target that is isolated from production, and deciding what counts as a pass. Running the drill includes restoring PostgreSQL to a chosen point in time, restoring binary storage, starting the Medplum server against the restored data, and checking that records, binaries and sign-in work. A drill that rebuilds infrastructure from code takes longer than one that restores into an existing standby environment. Ask for the drill steps and their expected durations in writing, and confirm timings by running a first drill on a copy of your data before relying on any estimate.
What does the customer team need to provide for backup and restore work?
The work needs access to the cloud account, data center or Kubernetes cluster that hosts Medplum, and named owners for the database, object or binary storage, secrets and DNS. Your team should supply the current deployment configuration, the Medplum version in use, the retention periods and recovery targets your policies require, and the locations where backups may be stored. Security and compliance staff need to confirm encryption key ownership, who may restore data, and where restore logs are kept. Plan for a test environment with enough capacity to restore a full copy, because a drill against production data is not a safe default. If your policies set recovery targets, get them written down before design starts, since they determine backup frequency and archive design.
Can an internal team set up and run Medplum backups without a partner?
Yes, an internal team with PostgreSQL, Linux, cloud storage and Medplum deployment experience can build and operate backups on its own. The questions to answer honestly are whether anyone on the team has restored PostgreSQL from a base backup and archived WAL files, whether they can rebuild the Medplum stack from its infrastructure definition, and whether there is cover for holidays and incidents. PostgreSQL provides continuous archiving and point-in-time recovery, but it does not provide failover detection, so any automation around recovery is additional work your team owns. A partner is useful when the team needs a fixed-scope design, a tested runbook and a first drill done in writing, then hands operation to staff. Ask any partner which parts of the work they run, which they only design, and what remains with you.
How do backups and restore drills support auditor evidence?
Backups support audit evidence when they produce records an assessor can inspect: the backup policy, the schedule and retention settings, job logs showing successful and failed runs, access records for restores, and dated drill reports showing that a restore reached an agreed state. Medplum's compliance documentation states that compliance is a shared responsibility between Medplum and its customers, so your team must hold the evidence for the parts you run. DeployOpen prepares systems, controls and evidence for compliance assessments, but it does not issue audit reports, attestations or certifications. Independent auditors and certification bodies make those determinations. Ask your assessor which artifacts they expect before the first drill so the drill report is written to meet them.
How should backups change around Medplum upgrades?
Take a fresh, verified backup before every Medplum upgrade step, and keep it until the upgraded system has passed its checks. Medplum's upgrade guidance says self-hosted deployments must move through each minor version in sequence, and that skipping versions causes startup failures. Post-deploy data migrations can run for hours or days on large datasets, so the rollback window and the backup you can restore from must cover that period. If a PostgreSQL major version upgrade is also planned, the backup method changes too, since PostgreSQL offers dump and restore, pg_upgrade and logical replication for major upgrades. Update the restore runbook and the drill for each upgrade, because a restore that worked on the previous Medplum version may need different steps after the schema changes.
Which PostgreSQL versions must a Medplum backup plan account for?
Plan around the PostgreSQL version your deployment runs and its support end date. According to PostgreSQL's versioning policy, version 14 is supported until November 12, 2026, version 15 until November 11, 2027, version 16 until November 9, 2028, version 17 until November 8, 2029, and version 18 until November 14, 2030. Restore targets must use a PostgreSQL version that can read the backup, and older unsupported versions should not hold production data. Confirm with your Medplum version and its database requirements which PostgreSQL major version you can run, because the schedule for a major upgrade should be set before the backup design is final.
How DeployOpen scopes and delivers backup and restore testing
DeployOpen plans, builds and documents backup and restore for a self-hosted Medplum deployment inside your own cloud accounts, data centers or air-gapped network. The work centers on proving that the PostgreSQL database, binary storage and configuration can be restored to a working Medplum stack, and that the proof is recorded in a form your compliance and security teams can review.
How we scope
- We agree in writing which PostgreSQL, binary storage, Redis and configuration assets are in scope before work starts.
- We confirm your recovery point and recovery time targets, and which Medplum version and database version the backups must support.
- We document where backups live, who can access them, and which restore scenarios the engagement will test.
How we build
- We configure base snapshots and continuous WAL archiving for PostgreSQL, using PostgreSQL's point-in-time recovery approach in your environment.
- We set up backup jobs for binary storage and configuration, with encryption, retention rules and access controls you approve.
- We write restore runbooks and run scheduled restore drills in an isolated environment, recording results and fixing gaps they expose.
How we hand over
- You receive runbooks, backup configuration, restore drill reports and a log of each test with its outcome and timing.
- We map the evidence to the controls your auditors ask about, without issuing any audit report or certification ourselves.
- We walk your platform and on-call teams through a live restore so they can repeat the procedure without us.
How we support
- Engagements are fixed-scope, and ongoing support, restore drills and continuous testing are available as a retainer.
- Retainers can cover repeat restore drills after each Medplum or PostgreSQL upgrade, when backup behavior should be re-verified.
- We review backup alerts, retention changes and drill results with your team on the cadence agreed in the retainer.

