---
title: Databases
url: "/docs/databases/"
canonical_url: https://docs.blossom88.com/docs/databases/
markdown_url: https://docs.blossom88.com/docs/databases.md
summary: Create database instances and manage the databases inside them
categories:
- data
- databases
---

# Databases

A **Database instance** runs PostgreSQL, MySQL, MariaDB or MongoDB and manages
compute, storage, connections and recovery. Create an instance, choose its
region, availability and storage, and review the estimate. Blossom continues
setup within your Location's capacity ceiling.

A **Database** holds an application's tables and data. A PostgreSQL instance can
host several Databases with separate application credentials, sharing its
compute, storage and whole-instance recovery. Creating another Database inside
it does not provision another Server. See
[Databases within an instance](/docs/reference/cli/database/).

| Engine | Version | Current protection |
| --- | --- | --- |
| [PostgreSQL](/docs/databases/postgres/) | 18 | Recovery backups, point-in-time recovery, read replicas, dedicated standby, automatic failover, and minor upgrades |
| [MySQL](/docs/databases/mysql/) | 9 | Recovery backups and public access over TLS |
| [MariaDB](/docs/databases/mariadb/) | 12 | Recovery backups and public access over TLS |
| [MongoDB](/docs/databases/mongodb/) | 8 | Recovery backups and public access over TLS |

## Availability

Choose the outcome when you create the Database instance. Blossom picks the Server
behind it either way. A new Database instance starts Shared where the
Location offers Data Capacity, and Dedicated elsewhere; Caches follow the same
rule.

| Option | What you get |
| --- | --- |
| Shared | Runs on your own Data Capacity with your other Shared Database and Cache instances, never with other customers. You pay for the Capacity and fit as many as their sizes allow. If the Capacity fails, Blossom recovers them together, and connections pause briefly. |
| Dedicated | One node on its own Server and failure boundary. Recommended for production. |

Both options keep the data on storage that follows the node when a Server
is replaced.

A Dedicated PostgreSQL Database instance can also run a standby, a setting like
Multi-AZ rather than a separate resource. Check **Standby with automatic
failover** when you create or edit the Database instance, or set `standby: true` in
the CLI or API; `standby: false` removes it. Blossom starts
the standby on another Server once the primary is ready, and fails over to it
automatically. The standby doubles the node and storage charge and needs
Backup Storage. Move the writer on purpose with
`blossom database_instance:switchover`.

Read replicas are separate resources added after creation, from the
Database instance's Nodes page or with
`blossom database_instance:replica:create`. An instance's primary, standby and replicas are kept apart, so one failure cannot remove
both the primary and its recovery candidate.

## Shared Sizes

Each Shared Database or Cache instance takes a size:

| Size | CPU and memory | Fits per 2 vCPU / 4 GB unit |
| --- | --- | --- |
| Small (default) | 0.5 vCPU / 875 MB | 4 |
| Medium | 1 vCPU / 1.75 GB | 2 |
| Large | 2 vCPU / 3.5 GB | 1 |

Memory uses exact decimal units. Allocations are 875,000,000,
1,750,000,000 and 3,500,000,000 bytes.
These counts describe reserved resources, not query throughput. Each persistent
Database or Cache node also has its own disk.

Presets start at Small; MongoDB starts at Medium, its default. Custom memory
accepts whole bytes, with minimums of 536,870,912 bytes for PostgreSQL/MySQL/
MariaDB, 1,073,741,824 for MongoDB and 268,435,456 for Redis/Memcached. Set
`size` to a name or an object:

```yaml
database_instance:
  availability: shared
  size: small # or {cpu_vcpus: 0.5, memory_gb: 0.75}
```

## Pricing

Shared bills whole Data Capacity units, with no per-instance compute
fee inside them. Four Small instances share one unit; a fifth adds a unit.
Dedicated nodes each have their own compute charge. Choose 2 vCPU / 4 GB,
4 vCPU / 8 GB or 8 vCPU / 16 GB; the compute charge scales 1×, 2× or 4×.
Each standby or replica adds its own compute and disk.

Cloud rates depend on provider and region. With Blossom BYOC (bring your own
cloud), Data management costs $10 per unit per 30 days. Shared and Dedicated
Data management are eligible for your Organization’s $20 monthly credit.
Your provider bills infrastructure separately. Cloud disks cost $0.15/GiB per
30 days; disks in your cloud have no Blossom surcharge. Charges follow elapsed time. See the
[pricing calculator](https://app.blossom88.com/pricing/calculator) for your
region and the estimate before creating a resource.

## Private Endpoint

Every Database instance has a private endpoint based on its stable resource id:

```text
database-instance-abc123.blossom.internal
```

Applications should use this endpoint rather than a provider address or
Container name. The hostname remains the same when Blossom recovers an instance
or promotes a PostgreSQL standby.

Database ports are private by default; public access is an explicit TLS
setting. Blossom generates credentials and redacts passwords from ordinary API responses, Activities, and logs. See
[Database And Cache Security](/docs/databases/security/).

## Connect An Environment

An Environment Link delivers the private connection URL to every Service in
the Environment:

```yaml
environment_link:
  environment_id: environment-100
  target_type: DatabaseInstance
  target_id: database_instance-100
  var_name: DATABASE_URL
```

For a specific PostgreSQL Database, use `target_type: Database` and its
`database-...` ID. Linking the instance selects its initial Database.

The linked variable includes the engine-specific scheme, credentials, private
hostname, port, and database name. The linked resource and Environment must
belong to the same Account and region.

## Rotate The Password

Rotate the password when it may have leaked or on a regular schedule:

    blossom database_instance:credentials:rotate --id database_instance-100 --follow

Blossom sets a new password inside the engine, including replicas and the
standby, then restarts every linked Environment so its Services receive the
new connection URL. The old password stops working. Connections pause briefly
while the password changes and the Environments restart. No application
change or manual copy is needed for linked Environments.

Show the new password with `database_instance:credentials`, or use **Rotate password**
on the Database instance credentials page. A client configured outside an
Environment Link must be updated by hand.

To choose the password yourself, for example to match an existing App, open
**Set your own password** on the credentials page, or pass it on stdin:

    printf '%s' "$NEW_PASSWORD" | blossom database_instance:credentials:rotate --id database_instance-100 --password-stdin --yes

New Database can take a chosen password too: select **Choose the password**,
or add `password:` to the definition file. A password needs 8 to 64
characters: letters, digits, and `! # % * + , - . / : = ? @ ^ _ ~`. For
PostgreSQL it belongs to the user your App connects as.

The **Username** on New Database (`username:` in the definition file) is the
user your App connects as, on every engine. On PostgreSQL it can't be
`postgres`, start with `pg_`, or use a name Blossom reserves.

## PostgreSQL Protection

Blossom-managed [Backup Storage](/docs/backups/) is selected by
default for encrypted recovery backups and point-in-time recovery. Add a
dedicated standby for planned switchover and automatic failover. Read replicas
have independent private endpoints and scale read traffic; they are not
automatic promotion candidates.

Blossom restores write availability before completing slower recovery work.
Promotion occurs only after Blossom has a healthy standby and proves
the old primary cannot accept writes. See
[PostgreSQL High Availability](/docs/databases/postgresql-high-availability/)
and [PostgreSQL Recovery Backups](/docs/backups/managed-database/).

## CLI

    blossom database_instance:init

writes database_instance.yml:

```yaml
database_instance:
  name: production
  # location_id: location-100 # optional: blossom location:list
  engine: postgres # postgres, mysql, mariadb, or mongodb
  availability: shared # the default where the Location has Data Capacity; or dedicated, its own Server
  # size: small # Shared only: small (default; MongoDB: medium), medium, large, or {cpu_vcpus: 0.5, memory_gb: 1}
  storage_gib: 20 # 10 to 1000 GiB; grows online later, never shrinks
  backup_storage_id: blossom_cloud # optional; Blossom Cloud storage under your Account, or your own backup_storage-... id
  # ...
```

    blossom database_instance:create --data database_instance.yml --follow
    blossom database_instance:list
    blossom database_instance:show --id database_instance-100
    blossom database_instance:console --id database_instance-100
    blossom database_instance:activity --id database_instance-100
    blossom database:list --database_instance database_instance-100
    blossom database:create --database_instance database_instance-100 --data '{"name":"demo_staging"}'
    blossom database:credentials --id database-100

Your Location's capacity ceiling is the standing approval: an instance that
would exceed it is refused with the amount it needs, and nothing is created.

Turn the standby on or off with `database_instance:update`, switch to it with
`database_instance:switchover`, and manage read replicas under `database_instance:replica:*`.
See the [`database_instance` CLI reference](/docs/reference/cli/database_instance/).

## External Databases

An application can connect to a database operated outside Blossom by setting
its connection URL as an Environment variable. Blossom does not monitor,
back up, fail over, or otherwise manage that external database.
