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 mongodbOptions:
| Flag | Description | Default |
|---|---|---|
--engine | Database engine: postgresql, redis, mongodb | postgresql |
--project | Project to associate with | Current project |
espacetech db list
List all your databases.
espacetech db listOutput:
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-postgresespacetech db credentials
Get connection credentials for a database.
espacetech db credentials my-postgresOutput:
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_mypostgresespacetech db link
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-appespacetech db unlink
Remove the link between a database and a project.
espacetech db unlink my-postgres --project my-appespacetech db expose
Enable external access to a database. Creates a publicly accessible proxy endpoint at *.db.espace-tech.com.
espacetech db expose my-postgresExposing 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-postgresespacetech db stop / db start
Stop or start a database to save resources.
espacetech db stop my-mongo
espacetech db start my-mongoespacetech db rotate
Rotate database credentials. Generates a new password and updates linked projects automatically.
espacetech db rotate my-postgresespacetech db delete
Permanently delete a database and all its data.
espacetech db delete my-postgresThis permanently deletes the database and all data. Create a backup first if you need to preserve data.