Skip to content

CLI reference

ry postgres

Markdown

Managed Postgres: create, branch, fork, sleep policy (stored; not in force on every host).

ry postgres [options] [command]

Alias: pg.

Create a Postgres database: the connection URL is in –json output only.

ry postgres create [options] <name>

Options:

  • -m, --memory <mb>: Memory in MB. Default: 1024.
  • -s, --size <gb>: Volume size in GB (minimum 4: the database keeps its write-ahead log on it). Default: 10.
  • --locale <locale>: Collation locale of the database, e.g. de-DE, fr-FR, de-DE-u-co-phonebk.
  • --always-on: Store the policy ‘always on’ (never suspend) instead of the default policy ‘suspend after 5m idle’.
  • --sleep-after <duration>: Store the sleep policy ‘suspend after this long without a query or traffic’, e.g. 5m, 1h (10s to 1d).

Example:

ry postgres create appdb
ry postgres create appdb --size 20 --locale en-US

List Postgres databases with their sleep policy.

ry postgres list [options]

Example:

ry postgres list

When a copy (fork or branch) is deleted: –in <duration>, –at <time> or –never.

ry postgres expire [options] <name>

Options:

  • --in <duration>: Delete it after this long from now, e.g. 12h, 7d (60s to 30d).
  • --at <time>: Delete it at this moment, ISO 8601 UTC (at most 30 days ahead).
  • --never: Keep it until somebody deletes it.

Example:

ry postgres expire appdb-try --in 12h

Set the sleep policy of the database: –after <duration> (e.g. 5m) or –off (always on).

ry postgres sleep [options] <name>

Options:

  • --after <duration>: Store ‘suspend after this long without a query or traffic’, e.g. 5m, 1h (10s to 1d).
  • --off: Store ‘always on’: never suspend.

Example:

ry postgres sleep appdb --after 10m
ry postgres sleep appdb --off

Branch a database from NOW: a copy-on-write snapshot on the source’s host, usable in seconds.

ry postgres branch [options] <source> <name>

Options:

  • --ephemeral: Throwaway branch for a test or a task: ready without its own backup, but lost with its host (never restarted empty).
  • --expires-in <duration>: Delete the branch after this long, e.g. 12h, 7d (60s to 30d).
  • --expires-at <time>: Delete the branch at this moment, ISO 8601 UTC (at most 30 days ahead).

Example:

ry postgres branch appdb appdb-try --expires-in 1d

Fork a database from its archive onto any host: a full copy, minutes for large databases; –at for a point in time.

ry postgres fork [options] <source> <name>

Options:

  • --at <time>: Restore to this point in time instead of now, ISO 8601 UTC, e.g. 2026-10-04T09:30:00Z (within the archive’s 7 days).
  • --expires-in <duration>: Delete the fork after this long, e.g. 12h, 7d (60s to 30d).
  • --expires-at <time>: Delete the fork at this moment, ISO 8601 UTC (at most 30 days ahead).

Example:

ry postgres fork appdb appdb-yesterday --at 2026-10-20T09:00:00Z

Put a database back to a point in time IN PLACE: same name and URL, the old state is kept as a branch.

ry postgres restore [options] <name>

Options:

  • --at <time>: The point in time, ISO 8601 UTC, e.g. 2026-10-07T09:30:00Z (within the archive’s 7 days).
  • --backup-name <name>: Name of the branch that keeps the old state (default <name>-old-<yyyymmddhhmmss>).
  • -y, --yes: Confirm without asking (automation, and the way back after consent).

Example:

ry postgres restore appdb --at 2026-10-20T09:00:00Z

Destroy a database, its machine and its volume (irreversible).

ry postgres destroy [options] <name>

Options:

  • -y, --yes: Confirm without asking (automation, and the way back after consent).

Example:

ry postgres destroy appdb-try --yes