API Gateway 11.1 | Administering API Gateway | Operating API Gateway | Data Management | Data Backup | Data Store Backup | Backup Repository | Configuring a Cloud Repository in Amazon S3
 
Configuring a Cloud Repository in Amazon S3
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.
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 external Elasticsearch.
*To configure an Amazon S3 cloud repository
1. From the command prompt, go to <Elastic_Dir>/bin.
2. Run the following command to create external 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 external 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 external Elasticsearch once you provide the secret key.
7. Create the Amazon S3 backup repository using the external 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 external 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 external 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 external 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 external Elasticsearch using Amazon S3 as the backend storage.