kvbox.cloud
Guides

Managed Postgres

A PostgreSQL 18 database kvbox runs for you. Give it a name; link a box to it or open it to the internet.

A managed database is one kvbox creates and runs. You give it a name and get back a user, a password and a connection string. There is no box to look after: no size to pick, nothing to install, and it never shows in kvbox ls.

kvbox pg create orders                   # PostgreSQL 18, 10 GB of storage, password generated
kvbox pg ls                              # your databases
kvbox pg info orders                     # status, connections, storage used, how to connect
kvbox pg password orders                 # the password, and the strings with it filled in

create prints the password and the connection string. Only the name is needed; the rest has defaults you can change:

OptionDefault
--database <name>the database's name (my-app becomes my_app)
--user <name>the same; it owns the database, may create more, and is never a superuser
--password <password>generated
--storage <GB>10
--near <box>any host; with it, the host of that box (a link from it then stays on that host's bridge)
--location <country or region>your default location; with it, only hosts inside it

A database and a box of the same account cannot share a name.

Who can reach it

Nobody, until you say so. There are two ways in.

A box of yours, privately. Link it, and inside that box the database is <name>.<account>.kvbox:5432 (your username, or the org's slug for an org's database):

kvbox pg create orders --near api        # on the same server as box api
kvbox pg link orders api                 # api may reach it
kvbox exec api -- psql "postgres://orders:<password>@orders.<account>.kvbox:5432/orders"
kvbox pg unlink orders api

A link works wherever the two are. On the same server it is the shortest path, so make the database next to the box (--near api) or a new box next to the database (kvbox new worker --near orders) when you can; on two servers the connection goes through the encrypted tunnel between them.

The internet. Open it, and it gets an address on its host:

kvbox pg public orders on                # postgres://orders:****@<host>:<port>/orders?sslmode=require
kvbox pg public orders off

The address is the database's own for its whole life: turning it off and on, stopping and starting it, all keep the same host and port. Connections are encrypted with the database's own certificate, which is self-signed, so the string asks for sslmode=require. Anyone with the address and the password gets in; keep the password long (the generated one is).

Password

kvbox pg password orders shows it to anyone who can see the database. kvbox pg password orders --reset generates a new one: the old one stops working at once, and whatever connected with it needs the new one.

Storage

Storage is the one number to watch. kvbox pg info orders shows what is used and warns when it is nearly full; a full database stops taking writes.

kvbox pg grow orders 50                  # to 50 GB

Storage only grows. Growing restarts a running database once, a few seconds without connections.

Stop, start, delete

kvbox pg stop orders                     # the data stays; only the storage is charged
kvbox pg start orders                    # the same addresses as before
kvbox pg rm orders                       # asks first; the data goes with it (its backups stay)

Backups

kvbox pg backup create orders            # start a backup; it runs in the background (--wait stays)
kvbox pg backup ls orders                # its backups, newest first; `ls` alone lists every database's
kvbox pg backup restore orders <id>      # the data becomes the backup's; asks first
kvbox pg backup rm orders <id>           # delete a backup for good; asks first
kvbox pg backup schedule orders --at 3   # its nightly backup at 03:00 UTC (--off, --on; alone: shows when)
kvbox pg create orders --from-backup <id> # a new database on a backup's data, a removed one's too

A backup is the database's storage at one instant, taken while it runs, encrypted and kept off its host: the same backups as a volume's. Postgres comes back from it the way it comes back from a power cut, replaying its log; no dump is needed. A database can take 2 backups in any 24 hours.

Each database is also backed up on its own every night, from the moment it is created, at an hour picked for it between 00:00 and 05:00 UTC. kvbox pg backup schedule orders shows when (and how the last one went), --at 3 moves it to 03:00 UTC, --off stops it and --on starts it again. A nightly backup does not count toward the 2 a day you may take yourself; backup ls shows it as by schedule. It is skipped while the account may not spend (out of credit or suspended), and one that fails is tried again within the hour for a few hours. A stopped database is backed up too. Every backup is kept 30 days.

restore throws away what was written since and restarts the database on the backup's data (a minute or so without connections). Its address, links, public port and current password stay: the password is set again once it is back, so a stopped database is refused: start it first. A backup of another major version is refused.

A backup outlives its database. After kvbox pg rm, kvbox pg backup ls (alone, or with the removed database's name) still lists its backups, and kvbox pg create <name> --from-backup <id> makes a new database on one: any name, the backup's database and user, a new password (generated, or --password), and at least the backup's storage. It waits for the download, which can take a while for a large one. A backup of a database that still exists is put back with restore instead. An org's backup makes a database in that org: add --org <org> to create.

Price

A database costs what runs it plus its storage, by the hour: about $7.60 a month with 10 GB, and $0.06 a month for each further GB. Stopped, only the storage is charged ($1.60 a month for 10 GB). create and info print the estimate for yours. In kvbox usage it is two lines: the database under its name, and its storage as a volume named pg- and six characters.

Orgs

A database belongs to you or to an org, like a box: --org <slug> on any command. Members see an org's databases and their passwords and may stop and start them; changing or deleting one is for whoever created it and for the org's admins.

Not yet

A schedule is daily only (no weekly, no hour in your own time zone). A backup cannot yet be copied into a second database while its own still exists. The version is PostgreSQL 18 with its defaults; there are no settings to tune, and no move to another host or to a later major version yet.

On this page