Self-Hosting Best Practices | Medplum

On this page

You've decided to self-host Medplum — great. This guide covers operational practices that will help you run a stable, maintainable deployment and set yourself up for long-term success.

These recommendations come from patterns we've seen across self-hosted deployments, both what works well and what causes pain down the road.

Infrastructure Organization

Use a Dedicated Cloud Account

Deploy your Medplum infrastructure in a dedicated cloud account (e.g., an AWS child account under your organization). This provides several benefits:

Infrastructure as Code

Manage all infrastructure through code (Terraform, CDK, CloudFormation, etc.) rather than manual console changes. This gives you:

Medplum provides CDK templates as a starting point. If you diverge from these templates, document your changes and the reasoning behind them.

Database Management

Treat the Database as Sacred

The Medplum database schema is managed by the application. Manual changes to PostgreSQL — adding tables, columns, indexes, or modifying data directly — can cause upgrade failures, unexpected behavior, and makes troubleshooting significantly harder.

If you need to make direct database changes:

  1. Document everything: Keep a log of what was changed, when, why, and by whom
  2. Understand the risks: Schema modifications may conflict with future Medplum upgrades
  3. Inform support: If you later engage Medplum for assistance, disclose any manual changes upfront — this information is critical for diagnosis

We strongly recommend treating direct database manipulation as a last resort, not a routine operational tool.

Plan for PostgreSQL Major Version Upgrades

PostgreSQL major version upgrades (e.g., 14 → 15 → 16) require manual intervention and planning. AWS does not automatically perform major version upgrades for RDS.

Observability and Monitoring

Medplum's infrastructure-as-code templates provide the core application components but are intentionally unopinionated about observability. Every organization has different tooling preferences and compliance requirements, so we leave this configuration to you.

That said, having observability is non-negotiable for production deployments.

Minimum Viable Monitoring

At a minimum, instrument monitoring for:

Component Key Metrics
Application servers CPU, memory, disk, network
PostgreSQL (RDS) CPU, memory, connections, replication lag, disk IOPS
Redis Memory usage, connections, evictions
Load balancer Request count, error rates, latency percentiles

Recommended Additions

Once basics are covered, consider adding:

Tooling Options

Common choices we've seen work well:

We're less concerned about which tool you choose and more concerned that something exists. Flying blind in production is how small issues become outages.

Capacity Planning

Don't Run Hot

There's a natural temptation to maximize utilization — running servers at 70-80% CPU feels like you're getting good value. The problem is that this leaves no headroom for traffic spikes, garbage collection pauses, or unexpected load.

Our recommendations:

A system with headroom absorbs surprises gracefully. A system running hot turns small spikes into cascading failures.

Connection Limits

Pay attention to database connection limits, especially as you scale horizontally. Each application server maintains a connection pool, and it's easy to exhaust RDS connection limits without realizing it.

Backup and Disaster Recovery

Verify Your Backups

Having automated RDS snapshots enabled is necessary but not sufficient. You should:

Multi-AZ and Redundancy

For production deployments, ensure:

Security Hygiene

Network Architecture

Secrets Management

Patching Cadence

Establish a regular schedule for:

Upgrade Strategy

Stay Reasonably Current

Drifting too far behind Medplum releases creates compounding problems:

We recommend staying within 2-3 minor versions of the latest release.

Maintain a Staging Environment

Before applying any Medplum upgrade to production:

  1. Apply the upgrade to a staging environment that mirrors production
  2. Run your test suite and smoke tests
  3. Verify integrations still work as expected
  4. Only then proceed to production

Subscribe to Release Notifications

Watch the Medplum GitHub releases or join the Discord to stay informed about new versions, security patches, and breaking changes.

Document Your Customizations

If you've made modifications beyond the standard Medplum deployment — custom bot dependencies, forked components, unusual configurations, additional services — document them thoroughly.

Future you, your teammates, and anyone providing support will need to understand:

Getting Help

Even well-run self-hosted deployments occasionally need assistance. To make support engagements productive:

Questions? Reach out to the Medplum team at support@medplum.com or on Discord.