Snapshotting to Google Cloud Storage (GCS) for Elasticsearch 7.xedit

Snapshotting to GCS repositories is natively supported in Elastic Cloud Enterprise beginning with version 7.0. For instructions on snapshotting for V6.4 - V6.8 Elasticsearch versions, see Snapshotting to Google Cloud Storage (GCS) for Elasticsearch 6.4 - 6.8. If you are using an earlier Elasticsearch version you must upgrade first.

Snapshots to GCS are supported using an advanced repository configuration and service account credentials that can administer your GCS bucket.

Set up your service account credentialsedit

You’ll need to have an existing Google Cloud account and have the appropriate permissions to generate credentials:

  1. Create service account credentials in your Google Cloud project where Elastic Cloud Enterprise is running.

    The service account should be granted the role of storage.admin so that Elasticsearch clusters can read, write, and list the bucket objects.

  2. Save the service account key in JSON file format. You are going to use it later to configure your Elasticsearch deployment for snapshotting.

Add the GCS repositoryedit

Add your Google Cloud Storage bucket as a repository to the platform:

  1. Log into the Cloud UI.
  2. Go to Platform > Repositories and add the following snapshot repository configuration under the advanced mode:

    Repository GCS (see: supported settings)

    {
      "type": "gcs",
      "settings": {
        "bucket": "foo-bar",
        "credentials_file": {
          "type": "service_account",
          "project_id": "[PROJECT-ID]",
          "private_key_id": "-----BEGIN PRIVATE KEY-----\n[PRIVATE-KEY]\n-----END PRIVATE KEY-----\n",
          "client_email": "[SERVICE-ACCOUNT-EMAIL]",
          "client_id": "[CLIENT-ID]",
          "auth_uri": "https://accounts.google.com/o/oath2/auth",
          "token_uri": "https://accounts.google.com/o/oauth2/token",
          "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
          "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/[SERVICE-ACCOUNT-EMAIL]"
        }
      }
    }

    The contents within credentials_file must be the exact contents of your GCS credentials file.

Snapshots are stored in the bucket you provide. Use the repository name you define here to configure your Elasticsearch clusters for snapshotting to this repository.

Configure your deployment for GCS snapshotsedit

To save deployment snapshots to the custom GCS repository:

  1. Create or use an existing deployment with an Elasticsearch cluster that has the repository-gcs plugin enabled.
  2. Configure your deployment to snapshot to the GCS repository.

After you enable snapshots, snapshotting will begin within 30 minutes (the default snapshot interval).