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

Name Required Type Description
cursor string

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.

limit integer

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

order enum string

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

Enum asc, or desc.

order_field string

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

Name Nullable Type Description
backups array of object of type ClusterBackup

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"
        }
    ]
}

The ClusterBackup object

Response for a cluster backup.

Name Nullable Type Description
finished_at string of date/time formatted as RFC 3339

Time at which the backup finished.

lsn_start string

The LSN (Log Sequence Number) where the backup was started.

lsn_stop string

The last LSN (Log Sequence Number) captured by the backup.

name string

Name of the backup.

size_bytes integer

The size of the backup in bytes.

started_at string of date/time formatted as RFC 3339

Time at which the backup was started.

Example

{
    "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"
}

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

Name Nullable Type Description
id string 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.

aws object of type AWSBackupToken

AWS pgBackRest credentials.

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

azure object of type AzureBackupToken

Azure pgBackRest credentials.

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

cluster_id string in EID format

The ID of the associated cluster.

repo_path string

The pgBackRest repository path.

stanza string

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_id string in EID format

The ID of the team which owns the associated cluster.

type enum string

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

Enum azure, or s3.

Example

{
    "aws": {
        "s3_bucket": "the-bucket",
        "s3_key": "key",
        "s3_key_secret": "secret",
        "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.

Name Nullable Type Description
s3_bucket string

S3 bucket used to store the repository.

s3_key string

S3 repository access key.

s3_key_secret string

S3 repository secret access key.

s3_region string

S3 repository region.

s3_token string

S3 repository security token.

The AzureBackupToken object

pgBackRest configuration relevant for a cluster hosted on Azure.

Name Nullable Type Description
azure_account string

Azure account used to store the repository.

azure_container string

Azure container used to store the repository.

azure_key string

Azure repository key.

azure_key_type enum string

Azure repository key type.

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

Enum sas, or shared.