Introducing VPC-isolated Postgres on Mastra Platform

Managed PostgreSQL for VPC-isolated deployments.

Paul ScanlonPaul Scanlon·

Oct 1, 2026

·

2 min read

You can now attach a VPC-isolated Postgres database to any environment on Mastra platform, letting you restrict access to same-network resources.

Typically, hosted databases are accessible from any client. Mastra platform's VPC provides an extra layer of security by preventing access from resources hosted outside the network.

In June, we launched managed databases with Turso and Neon. VPC Postgres joins the lineup for use cases where extra restrictions are required, with MongoDB and Redis coming soon.

When using a VPC-provisioned database, --region doesn't apply. The platform deploys the database to the same region as the environment to ensure it uses the same server network.

Get started

Install or upgrade the global Mastra CLI:

GNU BashTerminal
npm install -g mastra@latest
note
Requires mastra@1.32.0 or later, added in PR #25650.

Attach a database to an environment:

GNU BashTerminal
mastra env db create production --kind postgres

Or leave DATABASE_URL in .env unset and let the preflight checks run when you next deploy:

? Preflight needs DATABASE_URL for the production environment. Which managed database should be provisioned?
  ❯ Neon (serverless, public)
    Postgres (VPC-isolated)
    Skip — set it manually later

The platform injects DATABASE_URL at deploy time, so your PostgresStore config can remain the same:

TypeScriptsrc/mastra/index.ts
import { Mastra } from "@mastra/core/mastra";
import { PostgresStore } from "@mastra/pg";
 
export const mastra = new Mastra({
  // ...
  storage: new PostgresStore({
    id: "mastra-storage",
    connectionString: process.env.DATABASE_URL!
  })
});

Database status

You can't connect to a VPC database from outside the network. Using psql to connect will return an error:

psql: error: could not translate host name "mastra-vpc-postgres-8d60df8b14a4.railway.internal" to address: nodename nor servname provided, or not known

To check the status of a VPC database, use mastra env db show:

GNU BashTerminal
mastra env db show mastra-vpc-postgres-postgres

ready means provisioned and attached. mastra env db list reports the same for every database in the project and shows which environment each one is attached to.

mastra-vpc-postgres-postgres (postgres)
  ID: pdb_daff2f42-6974-428e-b7e5-a4261012113d
  Status: ready
  Scope: environment: mastra-vpc-postgres
  Region: us
  Created: 2026-10-01T10:20:06.581Z
 
  Connection env vars (injected automatically at deploy time):
    DATABASE_URL=******** (use --show-secrets to reveal)

For more information and full configuration options, see:

Share on X or LinkedIn
Paul Scanlon
Paul ScanlonTechnical Product Marketing Manager

Paul Scanlon sits between Developer Education and Product Marketing at Mastra. Previously, he was a Technical Product Marketing Manager at Neon and worked in Developer Relations at Gatsby, where he created educational content and developer experiences.

All articles by Paul Scanlon →