Managed Postgres Overview

Managed Postgres is currently in Technical Preview. This means it’s suitable for production workloads, but could be subject to unplanned maintenance or unexpected hiccups. Contact Fly.io support if you’re having issues.

Illustration by Annie Ruygt of a balloon doing a lot of tasks

What is Managed Postgres?

Fly.io’s Managed Postgres is our database-as-a-service offering where we handle:

  • Automatic backups and recovery
  • High availability with automatic failover
  • Performance monitoring and metrics
  • Resource scaling (CPU, RAM, storage)
  • 24/7 support and incident response
  • Automatic encryption of data at rest and in transit

What’s included

You’ll be able to access:

  • A highly-available Postgres cluster within your Fly.io organization’s private network
  • A single database on that cluster
  • Fly.io Support Portal to log tickets and get help
  • The pgvector extension for vector similarity search

What’s not there yet

At the moment, the following features are under development:

  • Security patches and version upgrades
  • Multiple databases or schemas per cluster
  • Postgres extensions besides pgvector
  • Customer-facing monitoring and alerting
  • Database migration tools

We’re working on expanding these capabilities and will provide updates as they become available.

Creating a Managed Postgres Instance

To create a new Managed Postgres cluster, visit your Fly.io dashboard and click the “Create new cluster” button in the Managed Postgres section.

You’ll be prompted to choose:

  • Cluster name (must be unique within your organization)
  • Region (see available regions below)
  • A plan with predefined hardware resources:
    • Launch: 2 vCPUs, 4GB RAM
    • Performance: 4 vCPUs, 8GB RAM
    • Enterprise: 8 vCPUs, 16GB RAM
  • Storage size (up to 500GB at creation)

A screenshot of the Managed Postgres creation page.

Connecting to Your Managed Postgres Database

To connect your Fly.io application to your Managed Postgres instance:

  1. After creation, the “Connection” tab will display your connection string
  2. Set it as a secret in your Fly.io application:
fly secrets set DATABASE_URL="postgres://username:password@host:port/database"
  1. Your application can now use the DATABASE_URL environment variable to connect

For security, the connection string uses SSL by default. Make sure your application’s Postgres client is configured to use SSL.

Using flyctl with Managed Postgres

You can interact with your Managed Postgres instances using the Fly.io CLI (flyctl). Here are the key commands:

Connecting with psql

To connect directly to your Managed Postgres database using psql:

fly mpg connect [flags]

This command will establish a direct connection to your database using the psql client. You’ll need psql installed locally.

Setting up a Proxy Connection

To create a proxy connection to your Managed Postgres database:

fly mpg proxy [flags]

This command is useful when you want to connect to your database from your local machine using tools other than psql, such as database management tools or your application in development.

Regions

The current regions available for deploying Fly.io Managed Postgres are:

  • fra - Frankfurt, Germany
  • gru - São Paulo, Brazil
  • iad - Ashburn, USA
  • lax - Los Angeles, USA
  • ord - Chicago, USA
  • syd - Sydney, Australia

We’ll be rolling out more regions as soon as we can. Choose a region close to your application for optimal performance.

Database Storage

Managed Postgres storage features:

  • Maximum storage limit: 1 TB
  • Initial storage size: Up to 500 GB at creation
  • Storage is replicated across all nodes in your cluster
  • Storage growth is monitored and managed automatically

Pricing

The price of running Fly.io Managed Postgres depends on:

  • CPU/Memory configuration (Launch, Performance, or Enterprise plans)
  • Region in which you’re deploying
  • Storage usage

Database storage is priced at $0.30 per GB for a 30-day month, with each node (primary + replica) incurring its own cost. You can view detailed pricing in your Fly.io dashboard.