Skip to Content
CLI ReferenceDatabases

Databases

Create and manage PostgreSQL, Redis, and MongoDB databases.

espacetech db create

Create a new managed database.

# PostgreSQL (default) espacetech db create my-postgres # Redis espacetech db create my-redis --engine redis # MongoDB espacetech db create my-mongo --engine mongodb

Options:

FlagDescriptionDefault
--engineDatabase engine: postgresql, redis, mongodbpostgresql
--projectProject to associate withCurrent project

espacetech db list

List all your databases.

espacetech db list

Output:

NAME ENGINE STATUS LINKED TO my-postgres postgresql running my-app my-redis redis running my-app my-mongo mongodb stopped —

espacetech db info

Show detailed information about a database.

espacetech db info my-postgres

espacetech db credentials

Get connection credentials for a database.

espacetech db credentials my-postgres

Output:

Host: pg-mypostgres-a1b2c3d4-0.databases.svc.cluster.local Port: 5432 User: u_mypostgres Password: xxxxxxxx Database: db_mypostgres URL: postgresql://u_mypostgres:xxxxxxxx@host:5432/db_mypostgres

Link a database to a project. This injects connection environment variables (DATABASE_URL, REDIS_URL, or MONGODB_URL) into the project.

espacetech db link my-postgres --project my-app

Remove the link between a database and a project.

espacetech db unlink my-postgres --project my-app

espacetech db expose

Enable external access to a database. Creates a publicly accessible proxy endpoint at *.db.espace-tech.com.

espacetech db expose my-postgres

Exposing a database makes it accessible from the internet. Use strong passwords and consider IP allowlisting.

espacetech db unexpose

Disable external access.

espacetech db unexpose my-postgres

espacetech db stop / db start

Stop or start a database to save resources.

espacetech db stop my-mongo espacetech db start my-mongo

espacetech db rotate

Rotate database credentials. Generates a new password and updates linked projects automatically.

espacetech db rotate my-postgres

espacetech db delete

Permanently delete a database and all its data.

espacetech db delete my-postgres

This permanently deletes the database and all data. Create a backup first if you need to preserve data.