deploy.host-database.move

Move the database to managed Postgres in one step: dump, create the role and database there, restore, bind

POST /deploy/api/apps/{id}/host-database/moveIAM deploy:ManageHostDatabaseChanges state

Also needs deploy:ManageDatabaseBinding and rds:ModifyDBInstance on the database (with instanceClass: on all databases, and rds:CreateDBInstance; checked before anything is created). The database must be a publicly accessible Postgres, since a pool host reaches managed Postgres only on its public endpoint; with instanceClass it is created so. It may still be creating: the move waits for it. The app is bound only after the restore succeeded. Writes made between the dump and the switch are not carried over, so move at a quiet time. The pool-host copy is dropped; its dump is kept 30 days.

Request syntax

POST /deploy/api/apps/{id}/host-database/move
{
  "dbInstanceId": "string",
  "instanceClass": "string"
}

Path parameters

  • idRequired

    string

    Constraints: uuid

Request body

  • dbInstanceIdOptional

    string

    An existing managed Postgres database to move to; it may still be creating (the move waits). Give this or instanceClass

    Constraints: 3-64 chars

  • instanceClassOptional

    string

    Or create a managed Postgres named <app slug>-db of this instance class (as rds instances create --instance-class), single node, in the app’s region

    Constraints: 1-32 chars

Response

202 with `data`: `jobId` (the move job; null when one for this app is already queued) and `database`, the managed Postgres identifier. 400 for a private database or one of another engine; 404 when the app has no active pool-host database or the database is not the caller’s; 409 when the app already has an unprefixed managed binding or its own DATABASE_URL; with instanceClass, a failed create answers 400 or 409 with the RDS error.

A JSON response is wrapped as { "success": true, "data": … }; the CLI prints the whole body with --json.

Fields of data

  • jobIdAlways

    string, may be null

    The move job; null when a move of this app is already queued
  • databaseAlways

    string

    Identifier of the managed Postgres it moves to

Checked against the handlers: every route test validates their answers against this schema.

Errors

  • 400The request does not pass the schema above. The body is { "error": …, "issues": […] }, one issue per field.
  • 401No credentials, or an access key that is unknown, revoked or expired.
  • 403The caller's policies do not allow deploy:ManageHostDatabase on this resource. The body names the action and the resource, and the refusal is recorded in the audit log.
  • 404The resource does not exist in your organization.

Examples

The required parameters only, with example values. Replace id and the other placeholders with your own.

dcloud deploy host-database move id

Generated from the API description, the same one the API checks requests against and the CLI is built from. MCP tool: dcloud_deploy_host-database_move.