dcloud deploy database bind

Bind a managed Postgres database (a dedicated app role by default)

IAM deploy:ManageDatabaseBindingChanges stateAsks before it deletes (-y skips)

mode=app_role creates role app_<slug> and its database (or grants on an existing one); its password is a secret the binding reads at every rollout. mode=master hands the app the master credential. Saving does not restart the app. Pass redeploy: true to roll the live deployment’s own source onto the new configuration (also needs deploy:DeployApp); otherwise the response and GET …/env report pending until someone redeploys.

Synopsis

dcloud deploy database bind id --db-instance-id dbInstanceId [flags]

Arguments

  • <id>Required

    string

    Also accepted as --id. Constraints: uuid

Flags

  • --db-instance-idRequired

    string

    The managed Postgres database (instance) to bind

    Constraints: 3-64 chars

  • --db-branch-idOptional

    string

    A branch of the database (ewbr-…) to connect to instead: the branch's master user and port, no pooler

    Constraints: /^ewbr-[0-9a-f]{12}$/

  • --databaseOptional

    string

    Database inside the instance (app_role mode creates it if missing). Default: the app’s slug as a Postgres name; in master mode or for a branch, the instance’s own database

    Constraints: /^[a-z_][a-z0-9_]{0,62}$/

  • --modeOptional

    enum

    app_role (default): a role of the app’s own, its password kept in Secrets; master: the instance’s master credential

    One of: app_role, master

  • --env-prefixOptional

    string

    Put in front of every generated variable name (e.g. CACHE_ gives CACHE_REDIS_URL), so one app can hold several bindings of a kind; default empty

    Constraints: max 32 chars, /^([A-Z][A-Z0-9_]*_)?$/

  • --pooledOptional

    boolean (--pooled / --no-pooled)

    Connect through the PgBouncer pooler (default true) or straight to Postgres on 5432; ignored for a branch

  • --redeployOptional

    boolean (--redeploy / --no-redeploy)

    Also roll the live deployment onto the new configuration; default false

Example

dcloud deploy database bind id --db-instance-id example

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