Postgres CLI Command Reference

Every dcloud rds command. The shape is dcloud <service> <resource> <verb>; every command also takes the global flags (--json, --profile, --dry-run, …).

dcloud rds instances

Managed Postgres databases, single-node or Patroni clusters

  • listList database instances
  • createCreate a database instance
  • getDescribe one database instance
  • deleteDelete a database instance and its machines
  • startStart a stopped database instance
  • stopStop a running database instance
  • rebootReboot a database instance
  • eventsThe activity stream of a database: the newest events, oldest first
  • rotate-master-passwordRotate the master password and file the new version in Secrets
  • modify-backup-settingsChange backup retention or the daily backup window
  • set-deletion-protectionTurn deletion protection on or off; while on, delete is refused
  • modify-storageResize storage or change the autoscaling ceiling
  • failoverPromote a replica and demote the current primary
  • rotate-storage-keyReplace the LUKS passphrase of every node’s data volume with a new key
  • modify-instance-classChange the machine type; a cluster is resized node by node and stays available
  • describe-maintenanceVersions per node, the pending minor upgrade, the maintenance window and when it next opens
  • modify-maintenanceSet the maintenance window (UTC) and automatic minor upgrades
  • logsThe PostgreSQL server log from every node, newest first; filter by text, node or severity. Kept 7 days
  • describe-parametersEvery settable PostgreSQL parameter: its machine-sized default, your value, what runs now
  • modify-parametersSet or reset PostgreSQL parameters; most apply at once, the answer lists those that wait for a restart
  • upgradeUpgrade to a newer minor now: a cluster rolls node by node with one switchover, a single node restarts once
  • add-readerAdd a read replica to a cluster; it serves on the reader endpoint (5433, 6433) once streaming
  • remove-readerRemove a read replica, its machine and its volume
  • list-nodesList the machines backing a database instance
  • clusterShow Patroni cluster membership and replication state

dcloud rds backups

pgBackRest backups and point-in-time restores

  • listList backups and the recoverable window
  • createTake a backup now
  • deleteDelete a backup taken by hand that is kept until deleted
  • list-restore-jobsList restore jobs for a database instance
  • restoreRestore to latest, to a timestamp, or to a labelled backup
  • cancel-restoreWithdraw a restore request that has not started

dcloud rds query-insights

Sampled statement history (pg_stat_statements, every minute, 7 days), findings with suggested actions, running sessions and the slow query log

  • getStatements of the range with load, trends and findings
  • get-statementOne statement with its generic plan and the index it suggests
  • list-tablesTables and indexes with findings: sequential scans, unused and duplicate indexes, vacuum overdue
  • list-sessionsClient sessions now: what runs, how long, what it waits for, who blocks it
  • cancel-sessionCancel a session’s running statement, or end the session
  • get-slow-logSlow query log settings and the statements (and plans) it captured
  • update-settingsSlow query log threshold, auto_explain, keeping values

dcloud rds data

Reading what is inside the database: its tables, rows and one read-only query

  • query-statsTop statements by time, calls or rows from pg_stat_statements; installed: false until the extension is on
  • list-relationsList schemas and tables with size and an estimated row count
  • read-rowsOne page of a table's rows, plus its column types
  • run-queryRun one read-only statement in a READ ONLY transaction with a statement timeout

dcloud rds extensions

Postgres extensions per database: the supported catalog, what is enabled, and the switches

  • listList supported extensions with installed and available versions, preload state and whether a restart is pending
  • enableCREATE EXTENSION in a database; 202 when its library must be preloaded and the database restarted first
  • disableDROP EXTENSION; 409 listing dependent objects unless cascade is true

dcloud rds server-types

The instance classes a database can be created with

  • listList available database instance classes

dcloud rds ca-bundle

The platform CA that signs every database server certificate

  • downloadDownload the CA bundle to use with sslmode=verify-full

dcloud rds tls

Whether a database refuses clients that do not use TLS, and which clients would break

  • getThe TLS requirement and certificate; with clients=true, every client connected without TLS on either port
  • setRequire TLS (hostssl, PgBouncer require) or stop requiring it, on every node; verified by a plaintext probe

dcloud rds replication

Whether a cluster commits synchronously (a failover loses nothing acknowledged) or asynchronously

  • getThe replication mode and whether it holds right now: ok, degraded (no standby acknowledging), async
  • setMake a cluster synchronous or asynchronous (live, no restart), and/or turn logical replication on or off (with a restart)

dcloud rds replication-slots

Logical replication slots for CDC (Debezium, Airbyte) and subscriptions; declared ones survive a failover

  • listEvery logical slot on the leader (declared or made in SQL): active, lag, WAL retained, whether it survives a failover
  • createDeclare a logical slot (pgoutput); on a cluster it is kept on every member
  • deleteDrop a logical slot, declared or made in SQL; its consumer has to resynchronise

dcloud rds branches

Copy-on-write branches of a database: masked, seconds to create, one per pull request

  • listA database's branches with where to connect, and its branch pool: machine, base age, masking, operation, space per branch
  • createCut a branch: a ZFS clone of the masked pool base, or a restore to a second
  • getOne branch: status, data as of, masking, connection, create time
  • get-credentialsThe branch's passwords (every login role) and a DATABASE_URL for its master user
  • modifySet when the branch is deleted (hours from now, at most 720)
  • deleteDelete a branch and what was written to it
  • get-settingsMasking rules and pull-request branches of a database
  • set-settingsSet the masking rules and pull-request branches (replaces both)
  • set-poolHow old the pool base may be before a new branch refreshes it
  • refresh-poolRestore the latest backup into a new pool base and mask it; existing branches keep theirs

dcloud rds logins

Per-person Postgres logins: read-only or read-write roles whose passwords are filed in Secrets

  • listList logins with who each is for, whether its role is on the server, and its open sessions
  • createCreate a login (read-only by default); the password goes to Secrets, never into the response
  • deleteRevoke a login: end its sessions, drop its role, delete its secret
  • modifySet or clear a login's expiry, at least five minutes ahead (to cut off now, revoke)
  • rotate-passwordNew password for a login, filed as a new version of the same secret (grants carry over)

Generated from the API description, the same one the API checks requests against and the CLI is built from.