diff --git a/README.md b/README.md index 2f6e04b61f0..f4b0cbd0971 100644 --- a/README.md +++ b/README.md @@ -164,7 +164,7 @@ The following settings are supported: * `bucket`: The name of the bucket to be used for snapshots. (Mandatory) * `region`: The region where bucket is located. Defaults to US Standard * `endpoint`: The endpoint to the S3 API. Defaults to AWS's default S3 endpoint. Note that setting a region overrides the endpoint setting. -* `protocol`: The protocol to use (`http` or `https`). Defaults to `https`. +* `protocol`: The protocol to use (`http` or `https`). Defaults to value of `cloud.aws.protocol` or `cloud.aws.s3.protocol`. * `base_path`: Specifies the path within bucket to repository data. Defaults to root directory. * `access_key`: The access key to use for authentication. Defaults to value of `cloud.aws.access_key`. * `secret_key`: The secret key to use for authentication. Defaults to value of `cloud.aws.secret_key`. @@ -266,8 +266,10 @@ The bucket needs to exist to register a repository for snapshots. If you did not ### Using other S3 endpoint -If you are using any S3 api compatible service, you can set the endpoint you want to use by setting `cloud.aws.s3.endpoint` -to your URL provider. +If you are using any S3 api compatible service, you can set a global endpoint by setting `cloud.aws.s3.endpoint` +to your URL provider. Note that this setting will be used for all S3 repositories. + +Different `endpoint`, `region` and `protocol` settings can be set on a per-repository basis (see [S3 Repository](#s3-repository) section for detail). ## Testing diff --git a/src/main/java/org/elasticsearch/cloud/aws/InternalAwsS3Service.java b/src/main/java/org/elasticsearch/cloud/aws/InternalAwsS3Service.java index 076c0f308e7..e2f9d17eb70 100644 --- a/src/main/java/org/elasticsearch/cloud/aws/InternalAwsS3Service.java +++ b/src/main/java/org/elasticsearch/cloud/aws/InternalAwsS3Service.java @@ -60,7 +60,7 @@ public class InternalAwsS3Service extends AbstractLifecycleComponent creating s3 repostoriy with endpoint [{}], bucket[{}] and path [{}]", bucketSettings.get("endpoint"), bucketSettings.get("bucket"), basePath); PutRepositoryResponse putRepositoryResponse = client.admin().cluster().preparePutRepository("test-repo") .setType("s3").setSettings(ImmutableSettings.settingsBuilder() - .put("protocol", bucketSettings.get("protocol")) + .put("bucket", bucketSettings.get("bucket")) .put("endpoint", bucketSettings.get("endpoint")) .put("access_key", bucketSettings.get("access_key")) .put("secret_key", bucketSettings.get("secret_key")) + .put("base_path", basePath) ).get(); assertThat(putRepositoryResponse.isAcknowledged(), equalTo(true)); assertRepositoryIsOperational(client, "test-repo"); @@ -445,7 +446,8 @@ abstract public class AbstractS3SnapshotRestoreTest extends AbstractAwsTest { Settings[] buckets = { settings.getByPrefix("repositories.s3."), settings.getByPrefix("repositories.s3.private-bucket."), - settings.getByPrefix("repositories.s3.remote-bucket.") + settings.getByPrefix("repositories.s3.remote-bucket."), + settings.getByPrefix("repositories.s3.external-bucket.") }; for (Settings bucket : buckets) { String endpoint = bucket.get("endpoint", settings.get("repositories.s3.endpoint"));