Skip to main content

Create a PostgreSQL backup

You can create a manual (on-demand) backup of your PostgreSQL cluster at any time.

Prerequisites

WAL (Write-Ahead Logging) archiving must be enabled on the cluster in order to create on-demand backups.

Permissions

info

This action requires the following IAM (Identity and Access Management) permissions:

  • postgresql.cluster.create

The POST /postgresql/spaces/{spaceId}/clusters/{clusterId}/backups request triggers an on-demand backup of a PostgreSQL cluster.

Parameters

ParameterTypeRequiredDescription
spaceIdUUID (Universally Unique Identifier)YesSpace identifier
clusterIdUUIDYesUnique identifier of the cluster

Request body

{
"name": "my-backup",
"target": "PREFER_STANDBY"
}
FieldTypeRequiredDescription
namestringNoBackup name (max 63 characters, strict slug format)
targetstringNoTarget node for running the backup. Possible values: PREFER_STANDBY (default), STANDBY, PRIMARY

Values of the target field

ValueDescription
PREFER_STANDBYRuns the backup from a standby node if one is available, otherwise from the primary (default behavior)
STANDBYRuns the backup only from a standby node. Fails if no standby is available
PRIMARYRuns the backup only from the primary node

Sample response

{
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"clusterId": "e592a4f6-2e49-46e7-b6d0-248a7711197a",
"name": "my-backup",
"type": "ON_DEMAND",
"status": {
"state": "CREATING",
"message": "Backup request submitted"
},
"startedAt": null,
"completedAt": null
}

The backup goes through the following states:

  1. CREATING — request submitted
  2. RUNNING — backup in progress
  3. SUCCEEDED — backup completed successfully
  4. FAILED — backup completed with an error

See the full specification

Cette page vous a-t-elle été utile ?