Cluster backup

List cluster backups and get pgBackRest configuration.

Backups are initiated automatically on a daily basis, and retained for about a week. New backups can be requested through the start backup endpoint.

Part of the API reference collection

This page is part of the Crunchy Bridge API reference, and primarily meant to act as an exhaustive guide for technical integrations which are already in progress. To understand the basics of using the API, see API concepts and getting started.

List backups

List available backups for a cluster.

This endpoint's pagination may be ordered through the order_field parameter by name only.

GET /clusters/{cluster_id}/backups

Request

Path parameters

  • cluster_id: ID of the cluster for which to get backups for.

Query parameters

NameRequiredTypeDescription
cursorstring

Return only items starting after this cursor ID. When paginating, pass the value of next_cursor from the last page into this field to get the next one.

Cursor values depend on the field in order_field. Cursors will often be the primary IDs of object, but when ordering on another field like name, they'll be names (or another value) instead.

limitinteger

The maximum number of items to return on the page. Defaults to 100 with a minimum of 1 and a maximum of 200.

orderstring

The order of pagination. asc for ascending or desc for descending. Defaults to asc.

Enum asc, or desc.

order_fieldstring

The name of the field on which to paginate like id or name. Supported fields are specific to each endpoint, and it's not possible to specify any arbitrary name. See the documentation for each specific list endpoint to see which fields it supports. Defaults to id for most resources.

cURL example

curl -X GET https://api.crunchybridge.com/clusters/{cluster_id}/backups
    -H "Authorization: Bearer $CRUNCHY_API_KEY"

Response

Status: 200

Response for a list of cluster backups.

Content type: application/json

NameNullableTypeDescription
backupsarray of array

The list of cluster backups.

Example

{
    "backups": [
        {
            "finished_at": "2022-05-07T01:00:02Z",
            "lsn_start": "AE0/9E000028",
            "lsn_stop": "AE0/A0051F10",
            "name": "2020/20200913-195337F",
            "size_bytes": 1852406161,
            "started_at": "2022-05-07T01:02:36Z",
            "type": ""
        }
    ]
}

Create backup token

Create backup token for configuring pgBackRest to restore from a cluster backup.

The endpoint returns configuration for a cloud provider's blob store (e.g. like Amazon's S3) which is the location of a pgBackRest repository. Configuring pgBackRest with this information will allow it to restore from the cluster's backups which are generated periodically as part of normal operation.

POST /clusters/{cluster_id}/backup-tokens

Request

Path parameters

  • cluster_id: ID of the cluster to create a backup token for.

cURL example

curl -X POST https://api.crunchybridge.com/clusters/{cluster_id}/backup-tokens
    -H "Authorization: Bearer $CRUNCHY_API_KEY"

Response

Status: 201

Content type: application/json

NameNullableTypeDescription
idstring in EID format

The primary ID of the backup token. Note that backup tokens aren't persisted in Bridge, so this can be used as a convenient way to uniquely identify a backup token, but not for much else.

awsobject of type AWSBackupTokenobject

AWS pgBackRest credentials.

Set for a cluster that's on the AWS provider, and omitted otherwise.

azureobject of type AzureBackupTokenobject

Azure pgBackRest credentials.

Set for a cluster that's on the Azure provider, and omitted otherwise.

cluster_idstring in EID format

The ID of the associated cluster.

gcpobject of type GCPBackupTokenobject

GCP pgBackRest credentials.

Set for a cluster that's on the GCP provider, and omitted otherwise.

repo_pathstring

The pgBackRest repository path.

stanzastring

The name of the configuration section for the target cluster in pgBackRest (pgBackRest supports multiple stanzas, but in practice there will only be one for a Bridge cluster). This name could be inferred through the use of other configuration parameters, but putting its value here allows pgBackRest to be configured locally more easily.

team_idstring in EID format

The ID of the team which owns the associated cluster.

typeenum string

Type of storage used for the repository and which to be used for pgBackRest configuration. azure for Azure Blob Storage Service, s3 for AWS Simple Storage Service, or gcs for Google Cloud Storage.

Enum azure, gcs, or s3.

Example

{
    "aws": {
        "s3_bucket": "the-bucket",
        "s3_key": "key",
        "s3_key_secret": "secret",
        "s3_kms_key_id": null,
        "s3_region": "us-west-1",
        "s3_token": "token"
    },
    "cluster_id": "rvf73a77ozfsvcttryebfrnlem",
    "id": "agaqf6fanse45vspjcctakuyky",
    "repo_path": "/the-path",
    "stanza": "2qc6yv2ztfcw7a7yoripu4zlsm",
    "team_id": "eaevtjiudzeq7bsqbbpiscund4",
    "type": "s3"
}

The AWSBackupToken object

pgBackRest configuration relevant for a cluster hosted on AWS.

NameNullableTypeDescription
s3_bucketstring

S3 bucket used to store the repository.

s3_keystring

S3 repository access key.

s3_key_secretstring

S3 repository secret access key.

s3_kms_key_idstring

AWS KMS (Key Management Service) key used for at-rest encryption of the S3 repository.

s3_regionstring

S3 repository region.

s3_tokenstring

S3 repository security token.

The AzureBackupToken object

pgBackRest configuration relevant for a cluster hosted on Azure.

NameNullableTypeDescription
azure_accountstring

Azure account used to store the repository.

azure_containerstring

Azure container used to store the repository.

azure_keystring

Azure repository key.

azure_key_typeenum string

Azure repository key type.

The following types are supported for authorization: * shared - Shared key * sas - Shared access signature

Enum sas, or shared.

The GCPBackupToken object

pgBackRest configuration relevant for a cluster hosted on GCP.

NameNullableTypeDescription
gcs_bucketstring

GCS bucket used to store the repository.