Configuring a Cloud Repository in Amazon S3
About this task
You can configure the following types of cloud repositories:
- Amazon S3
- Azure storage. For information on setting up a Azure cloud repository, see https://www.elastic.co/guide/en/cloud/current/ec-azure-snapshotting.html.
To configure an Amazon S3 cloud repository
- From the command prompt, go to SAGInstallDir/InternalDataStore/bin.
- Run the following command
to create Elasticsearch keystore:
Linux
Windows./elasticsearch-keystore create
elasticsearch-keystore.bat create
- Run the following command to
add the Amazon S3 repository access key to your Elasticsearch keystore:
Linux
Windows./elasticsearch-keystore add s3.client.default.access_key
elasticsearch-keystore.bat add s3.client.default.access_key
- 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
- Run the following command
to add the Amazon S3 repository secret key:
Linux
Windows./elasticsearch-keystore add s3.client.default.secret_key
elasticsearch-keystore.bat add s3.client.default.secret_key
- 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. - 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
andes-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 (\). - Replace
- 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.