Skip to main content
You can run Postgres, Redis, MySQL, or MongoDB on Beam. Each database includes a durable disk, generated credentials, and a TLS connection.

Create a Database

Each command creates a separate database with 1 CPU and 512 MB of memory. Names must be unique in your workspace. Use --cpu, --memory, --database, or --username to customize it. To supply a password, use --password-from-env VARIABLE_NAME or --password-stdin. Databases are also available in the dashboard and through MCP’s create_database tool.

Connect an App

Pass the database URL as an environment reference:
Python apps accept the same references in env:
For an existing app, edit its environment variables in the dashboard or use MCP’s connect_services. Both deploy a new version.

Connect from Your Machine

Print a connection command for Postgres or Redis:
Run the printed command with psql or redis-cli installed. The output contains credentials. For other clients, use beam db KIND credentials NAME. Redis also supports connect --node-redis and --ioredis for TLS connection examples.

Serverless or Always On

Databases shut down after 300 idle seconds by default. To avoid cold starts, keep one replica running:
Use --min-replicas 1 at creation for always-on mode. Each database has one writable replica; clients should reconnect after restarts or resource changes.

Credentials and Lifecycle

Rotation restarts the database and apps using its generated secrets. Update any connection strings you copied manually. beam db postgres delete web-db deletes the service and credentials, but keeps the durable disk. Use beam disk list to find it. See disk snapshots for backups.