# Databases — Codara Cloud Docs

> Provision managed Postgres, MySQL, MariaDB, MongoDB or Redis, connect it to an app, and restore from backup.

Canonical: https://codaracloud.com/docs/guides/databases

## Supported engines

| Engine | Isolation | Notes |
| --- | --- | --- |
| postgres | Shared or dedicated | The best-supported engine — the only one with the table browser. Shared Postgres has self-serve backup and restore. |
| redis | Shared or dedicated | Caching, queues and sessions. Shared Redis has no backups; dedicated Redis has self-serve backup and restore. |
| mariadb | Dedicated only | MySQL-compatible. |
| mysql | Dedicated only |  |
| mongodb | Dedicated only |  |

### Shared versus dedicated

A **shared** database is a tenant on a pooled instance: cheaper, quick to provision, and appropriate for development and small workloads. A **dedicated** database gets its own instance with its own CPU, memory and disk.

The `starter` tier defaults to shared; `standard` and `pro` are always dedicated.

### Tiers

| Tier | Isolation | Storage ceiling |
| --- | --- | --- |
| starter | Shared by default | 10 GiB |
| standard | Dedicated | 20 GiB |
| pro | Dedicated | 100 GiB |

Every database starts with 10 GiB of storage regardless of tier; the tier sets how far it can grow.

Tiers are database sizes, not plans

A database’s storage counts toward your plan’s persistent storage: 20 GiB on Starter, 40 GiB on Standard, 80 GiB on Pro and 150 GiB on Scale, plus any extra storage you buy. A tier’s ceiling can be larger than what your plan has left, so check [your plan’s limits](https://codaracloud.com/pricing) before choosing one.

## Creating a database

From the console, open the environment’s canvas and add a database. From the CLI:

bash

```
$ codaracloud databases create main-db \
    --engine postgres \
    --tier standard \
    --client my-workspace \
    --project website \
    --env production

$ codaracloud databases list --client my-workspace
```

Some choices are permanent

The engine, version, isolation and region cannot be changed after creation. Tier, replicas, storage size and connection pooling can be changed later with `codaracloud databases upgrade`. If you need a different engine or isolation, create a new database and migrate.

## Connecting it to an app

Connecting a database projects its credentials into the app as environment variables and restarts the app to pick them up. You never copy a password by hand.

bash

```
$ codaracloud apps connections add my-api main-db --client my-workspace

# Rename the injected variables with a prefix
$ codaracloud apps connections add my-api cache-db --as CACHE --client my-workspace

$ codaracloud apps connections list my-api --client my-workspace
```

### What gets injected

Postgres:

| Variable | Contains |
| --- | --- |
| DATABASE_URL | The connection URL your app should use. |
| DATABASE_DIRECT_URL | A direct connection, bypassing any pooler. Migration tools usually want this one. |
| DATABASE_HOST / PORT / NAME / USER / PASSWORD | The same details as separate values. |

Redis provides `REDIS_URL` and its components; MySQL and MariaDB provide `MYSQL_URL`; MongoDB provides `MONGODB_URL`. Without `--as`, the database name is the prefix; when it already matches an engine prefix, keys such as `DATABASE_URL` and `REDIS_URL` are not doubled. An explicit `--as CACHE` namespaces every key, for example `CACHE_REDIS_URL` and `CACHE_PASSWORD`.

Connection pooling

Shared Postgres databases are served through a connection pooler. Dedicated Postgres currently connects directly — the pooled and direct URLs are the same value there. Either way, use `DATABASE_URL` for your application and `DATABASE_DIRECT_URL` for migrations.

## Connecting from your machine

To inspect a database locally, open a tunnel through the platform. This needs no cluster access of any kind:

bash

```
# Opens a local tunnel; Ctrl-C to stop
$ codaracloud databases proxy main-db --client my-workspace --local-port 5432

# In another terminal
$ psql "postgresql://user:pass@127.0.0.1:5432/main-db"
```

To see the credentials themselves:

bash

```
# Masked by default
$ codaracloud databases connection main-db --client my-workspace

# Show the password and full URL
$ codaracloud databases connection main-db --client my-workspace --reveal
```

An API token needs the `db:connect` scope to open a tunnel. The scope is available in both the console token screen and the CLI.

### Table browser

The console includes a read-only table browser for Postgres databases — open the database and choose **Studio**. It lists tables and pages through rows. It is deliberately read-only and does not accept arbitrary SQL; use a tunnel and your own client for that.

## Backups

Check protection on each resource: a supported engine alone does not prove that a recent usable backup exists. Protection depends on the engine, isolation mode and enabled backup configuration. Verify the last successful backup and restore support before relying on it.

Enabled scheduled backups use the database’s configured cron expression; the platform default is daily at 03:00. They are stored in off-provider object storage.

| Engine | Backups | Restore |
| --- | --- | --- |
| Postgres (shared) | Daily dump, when you turn it on | Self-serve |
| Postgres (dedicated) | Always on: weekly base backup plus continuous WAL archiving | By Codara — ask support |
| Redis (shared) | **None** — keys may be evicted | None |
| Redis (dedicated) | Daily dump, when you turn it on | Self-serve |
| MariaDB, MySQL, MongoDB | Daily dump, when you turn it on | By Codara — ask support |

On self-serve plans, backups are kept for at most 7 days. Every restore creates a new database.

Dedicated Postgres is always backed up

You cannot turn backups off for a dedicated Postgres database. This is deliberate.

Not every database can be restored by you

Do not assume every engine or isolation mode is protected. You can restore shared Postgres and dedicated Redis yourself. Dedicated Postgres, MariaDB, MySQL and MongoDB restores are done by Codara on request. Shared Redis has no backups. MariaDB, MySQL and MongoDB dumps do not appear in the CLI or API backup list even though they are being taken. If you are relying on being able to restore quickly yourself, use shared Postgres.

### Taking a backup on demand

bash

```
$ codaracloud databases backup main-db --wait --client my-workspace
```

This is available for Postgres (shared and dedicated) and dedicated Redis, once per database per UTC day. `--wait` returns when the backup is a completed recovery point.

### Restoring

A restore always creates a **new** database — it never overwrites the source. The restore needs temporary capacity while both copies exist. After verifying the restored data, repoint your app at the new database. The commands below work for shared Postgres and dedicated Redis.

bash

```
$ codaracloud databases restore main-db \
    --from <backup-name> \
    --as main-db-recovered \
    --client my-workspace

# Then repoint the app
$ codaracloud apps connections rm my-api main-db --client my-workspace
$ codaracloud apps connections add my-api main-db-recovered --client my-workspace
```

## Growing a database

bash

```
$ codaracloud databases upgrade main-db \
    --tier pro \
    --storage-size 50Gi \
    --client my-workspace
```

Storage can only grow, never shrink. Databases can also grow their own disk automatically as they approach capacity, up to the tier ceiling.

## Deleting a database

bash

```
# Shared Postgres: take it offline and retain its data
$ codaracloud databases delete main-db --client my-workspace --confirm main-db

# Bring the same data back with a fresh credential
$ codaracloud databases reactivate main-db --client my-workspace

# Permanent shared-Postgres purge (irreversible)
$ codaracloud databases delete main-db --client my-workspace --purge --confirm main-db
```

Normal shared-Postgres removal revokes its credentials and keeps a visible, recoverable retained record. Reactivation uses the same logical database and always generates a fresh password. Permanent purge requires the exact-name confirmation and also erases the database’s backups.

Deleting a dedicated database destroys its data

For dedicated engines the underlying disk and the database’s backups are deleted with the database, and support cannot undo it. If there is any chance you will want the data again, restore a copy or export it before deleting.

## Importing existing data

Postgres and MariaDB databases can be seeded from a dump file reachable over HTTPS. The import runs as a one-off task inside the platform. This is available through the API and the MCP tools rather than the CLI.

## Metrics

Dedicated databases report CPU, memory and storage on the database page. Shared databases report storage only — CPU and memory belong to the pooled instance and cannot be attributed to a single tenant, so those charts render empty rather than showing a misleading zero.

Last updated 26 September 2026
