Share a repository across clustersedit

Create a custom repository that references another cluster’s repository.

To restore a snapshot from one cluster to another cluster, both clusters must be in the same region.

If you do a GET /_snapshot/found-snapshots request, you can find the name of your bucket. Here’s an example:

{
  "found-snapshots" : {
    "type" : "s3",
    "settings" : {
      "bucket" : "[RANDOM_STRING]",
      "base_path" : "snapshots/[cluster-id]",
      "server_side_encryption" : "true",
      "compress" : "true"
    }
  }
}

The random string bucket name is the same for all your clusters in that region. All nodes in your clusters in that region are configured with credentials that have access to that bucket. The only thing that differs is the base_path.

You can create a reference to the repository associated with another cluster by creating a second repository. For example, to copy indices from a production cluster to a dev cluster, you can run PUT /_snapshot/production on the dev cluster with the following body to create a second repository. Ensure to use readonly when you register the same repository with multiple clusters as only one cluster (in this case, production) should have write access to the repository while all other connected clusters (in this case, dev) have readonly access. For example:

{
  "type": "s3",
  "settings" : {
    "bucket": "[RANDOM_STRING]",
    "base_path": "snapshots/[production-cluster-id]",
    "server_side_encryption": "true",
    "compress": "true",
    "readonly": "true",
    "aws_account": "[my-operations-account]",
    "client": "[dev-client]"
  }
}

You should see snapshots on the dev cluster from the production cluster with GET _snapshot/production/_all. Then you can restore indices from the production cluster to the dev cluster by, for example, running POST /_snapshot/production/[my-snapshot]/_restore on the dev cluster.

When you use the same repository across clusters, you are responsible for not writing to the same location at the same time.