Configuring a Cloud Repository in Amazon S3

About this task

You can configure the following types of cloud repositories: This section explains the steps to configure an Amazon S3 repository. To configure a repository, ensure that you have installed the Amazon S3 plugin in Elasticsearch.

To configure an Amazon S3 cloud repository

  1. From the command prompt, go to SAGInstallDir/InternalDataStore/bin.
  2. Run the following command to create Elasticsearch keystore:
    Linux
    ./elasticsearch-keystore create
    Windows
    elasticsearch-keystore.bat create
  3. Run the following command to add the Amazon S3 repository access key to your Elasticsearch keystore:
    Linux
    ./elasticsearch-keystore add s3.client.default.access_key
    Windows
    elasticsearch-keystore.bat add s3.client.default.access_key
  4. When prompted for the Amazon S3 repository access key, type the access key value and press Enter.
    Enter value for s3.client.default.access_key: 123-test-123d-123
  5. Run the following command to add the Amazon S3 repository secret key:
    Linux
    ./elasticsearch-keystore add s3.client.default.secret_key
    Windows
    elasticsearch-keystore.bat add s3.client.default.secret_key
  6. When prompted for the Amazon S3 repository secret key, type the secret key value and press Enter.
    Enter value for s3.client.default.secret_key: tests1232sk12312t
    Important: You must restart Elasticsearch once you provide the secret key.
  7. Create the Amazon S3 backup repository using the Elasticsearch API.
    curl -X POST "http://es-host:es-port/_snapshot/s3-repo-name" -H 'Content-Type: application/json' -d '
    {
      "type": "s3",
      "settings": {
        "bucket": "bucket-name",
        "region": "region",
        "base_path": "s3-base-path",
        "access_key": "your_access_key",
        "secret_key": "your_secret_key",
        "apigw_config_backup_path": "s3-config-path",
        "apigw_packages_backup_path": "s3-packages-path"
      }
    }
    '

    In this command:

    • Replace es-host and es-port with the hostname and port of your Elasticsearch cluster.
    • Replace s3-repo-name with the name of the backup repository you are creating.
    Note: The base_path value must not start or end with an slash (\).
  8. Confirm repository creation using the Elasticsearch API:
    curl -X GET "http://es-host:es-port/_snapshot/s3-repo-name"

    In this command:

    • Replace es-host and es-port with the hostname and port of your Elasticsearch cluster.
    • Replace s3-repo-name with the name of the backup repository you are creating.

    This command returns information about the s3-repo-name repository, confirming that it is created successfully.

    You have set up a backup repository in Elasticsearch using Amazon S3 as the backend storage.