»Create/update an automated snapshots config

This endpoint requires sudo capability.

This endpoint creates or updates a named configuration. Each configuration has an interval controlling how often snapshots are taken, a destination where the snapshots are written, as well as a retention policy governing when older snapshots get deleted.

Note that for cloud storage types, you can either provide credentials explicitly using the parameters below, or omit them and rely on the cloud provider's other mechanisms to provide access to cloud resources.

MethodPath
POST/sys/storage/raft/snapshot-auto/config/:name

»Parameters

  • name (string: <required>) – Name of the configuration to modify.

  • interval (integer or string: <required>) - Time between snapshots. This can be either an integer number of seconds, or a Go duration format string (e.g. 24h)

  • retain (integer: 1) - How many snapshots are to be kept; when writing a snapshot, if there are more snapshots already stored than this number, the oldest ones will be deleted.

  • path_prefix (string: <required>) - For storage_type=local, the directory to write the snapshots in. For cloud storage types, the bucket prefix to use.

  • file_prefix (string: "vault-snapshot") - Within the directory or bucket prefix given by path_prefix, the file or object name of snapshot files will start with this string.

  • storage_type (string: <required>) - One of "local", "azure-blob", "aws-s3", or "google-gcs". The remaining parameters described below are all specific to the selected storage_type and prefixed accordingly.

»storage_type=local

  • local_max_space (integer: <required>) - For storage_type=local, the maximum space to use for snapshots. Snapshot attempts will fail if there is not enough space left in this allowance.

»storage_type=aws-s3

»storage_type=google-gcs

  • google_gcs_bucket (string: <required>) GCS bucket to write snapshots to.

  • google_service_account_key (string) - Google service account key in JSON format

  • google_endpoint (string) - GCS endpoint. This is typically only set when using a non-Google GCS implementation like fake-gcs-server.

  • google_disable_tls (boolean) - Disable TLS for the GCS endpoint. This should only be used for testing purposes, typically in conjunction with google_endpoint.

»storage_type=azure-blob

»Sample Payload

{
  "interval": "24h",
  "retain": 7,
  "path_prefix": "/opt/vault/snapshots/",
  "storage_type": "local",
  "local_max_space": 10000000
}

»Sample Request

$ curl \
    --header "X-Vault-Token: ..." \
    --request POST \
    --data @payload.json \
    http://127.0.0.1:8200/v1/sys/storage/raft/snapshot-auto/config/config1

»List automated snapshots configs

This endpoint requires sudo capability.

This endpoint lists named configurations.

MethodPath
LIST/sys/storage/raft/snapshot-auto/config

»Sample Request

$ curl \
    --header "X-Vault-Token: ..." \
    --request LIST \
    http://127.0.0.1:8200/v1/sys/storage/raft/snapshot-auto/config

»Sample Response

{
  "data": {
    "keys": [
      "config1"
    ]
  }
}

»Read automated snapshots config

This endpoint requires sudo capability.

This endpoint reads a named configuration.

MethodPath
GET/sys/storage/raft/snapshot-auto/config/:name

»Sample Request

$ curl \
    --header "X-Vault-Token: ..." \
    http://127.0.0.1:8200/v1/sys/storage/raft/snapshot-auto/config/config1

»Sample Response

{
  "data": {
    "file_prefix": "vault-snapshot",
    "interval": 86400,
    "local_max_space": 10000000,
    "path_prefix": "/opt/vault/snapshots/",
    "retain": 7,
    "storage_type": "local"
  }
}

»Delete automated snapshots config

This endpoint requires sudo capability.

This endpoint deletes a named configuration.

MethodPath
DELETE/sys/storage/raft/snapshot-auto/config/:name

»Sample Request

$ curl \
    --header "X-Vault-Token: ..." \
    --request DELETE \
    http://127.0.0.1:8200/v1/sys/storage/raft/snapshot-auto/config/config1

»Read automated snapshots status

This endpoint returns the status of a named configuration.

MethodPath
GET/sys/storage/raft/snapshot-auto/status/:name

»Sample Request

$ curl \
    --header "X-Vault-Token: ..." \
    http://127.0.0.1:8200/v1/sys/storage/raft/snapshot-auto/status/config1

»Sample Response

{
  "data": {
    "last_snapshot_end": "2020-10-28T11:17:21-04:00",
    "last_snapshot_error": "",
    "last_snapshot_start": "2020-10-28T11:17:21-04:00",
    "last_snapshot_url": "file:///opt/vault/snapshots/vault-snapshot-1603898241699731000.snap",
    "snapshot_start": "2020-10-28T11:17:21-04:00",
    "snapshot_url": "file:///opt/vault/snapshots/vault-snapshot-1603898241699731000.snap"
  }
}