Skip to content

Commit 0266479

Browse files
authored
Docs: Update s3 repository docs with client settings (#26033)
This commit updates the s3 repository docs to clearly mark settings as part of the s3 client settings, as well as those that are secure and must be stored in the elasticsearch keystore. relates #25619
1 parent e11cbed commit 0266479

File tree

1 file changed

+89
-119
lines changed

1 file changed

+89
-119
lines changed

docs/plugins/repository-s3.asciidoc

Lines changed: 89 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -12,98 +12,121 @@ include::install_remove.asciidoc[]
1212
[[repository-s3-usage]]
1313
==== Getting started with AWS
1414

15-
The plugin will default to using
15+
The plugin provides a repository type named `s3` which may be used when creating a repository.
16+
The repository defaults to using
1617
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/iam-roles-for-amazon-ec2.html[IAM Role]
17-
credentials for authentication. These can be overridden by, in increasing
18-
order of precedence, system properties `aws.accessKeyId` and `aws.secretKey`,
19-
environment variables `AWS_ACCESS_KEY_ID` and `AWS_SECRET_KEY`, or the
20-
elasticsearch config using `cloud.aws.access_key` and `cloud.aws.secret_key` or
21-
if you wish to set credentials specifically for s3 `cloud.aws.s3.access_key` and `cloud.aws.s3.secret_key`:
18+
credentials for authentication. The only mandatory setting is the bucket name:
2219

23-
[source,yaml]
20+
[source,js]
2421
----
25-
cloud:
26-
aws:
27-
access_key: AKVAIQBF2RECL7FJWGJQ
28-
secret_key: vExyMThREXeRMm/b/LRzEB8jWwvzQeXgjqMX+6br
22+
PUT _snapshot/my_s3_repository
23+
{
24+
"type": "s3",
25+
"settings": {
26+
"bucket": "my_bucket"
27+
}
28+
}
2929
----
30+
// CONSOLE
31+
// TEST[skip:we don't have s3 setup while testing this]
32+
3033

31-
[[repository-s3-usage-security]]
32-
===== Transport security
34+
[[repository-s3-client]]
35+
==== Client Settings
3336

34-
By default this plugin uses HTTPS for all API calls to AWS endpoints. If you wish to configure HTTP you can set
35-
`cloud.aws.protocol` in the elasticsearch config. You can optionally override this setting per individual service
36-
via: `cloud.aws.ec2.protocol` or `cloud.aws.s3.protocol`.
37+
The client used to connect to S3 has a number of settings available. Client setting names are of
38+
the form `s3.client.CLIENT_NAME.SETTING_NAME` and specified inside `elasticsearch.yml`. The
39+
default client name looked up by an s3 repository is called `default`, but can be customized
40+
with the repository setting `client`. For example:
3741

38-
[source,yaml]
42+
[source,js]
3943
----
40-
cloud:
41-
aws:
42-
protocol: https
43-
s3:
44-
protocol: http
45-
ec2:
46-
protocol: https
44+
PUT _snapshot/my_s3_repository
45+
{
46+
"type": "s3",
47+
"settings": {
48+
"bucket": "my_bucket",
49+
"client": "my_alternate_client"
50+
}
51+
}
4752
----
53+
// CONSOLE
54+
// TEST[skip:we don't have s3 setup while testing this]
4855

49-
In addition, a proxy can be configured with the `proxy.host`, `proxy.port`, `proxy.username` and `proxy.password` settings
50-
(note that protocol can be `http` or `https`):
56+
Some settings are sensitive and must be stored in the {ref}/secure-settings.html[elasticsearch keystore].
57+
For example, to use explicit AWS access keys:
5158

52-
[source,yaml]
59+
[source,sh]
5360
----
54-
cloud:
55-
aws:
56-
protocol: https
57-
proxy:
58-
host: proxy1.company.com
59-
port: 8083
60-
username: myself
61-
password: theBestPasswordEver!
61+
bin/elasticsearch-keystore add s3.client.default.access_key
62+
bin/elasticsearch-keystore add s3.client.default.secret_key
6263
----
6364

64-
You can also set different proxies for `ec2` and `s3`:
65+
The following are the available client settings. Those that must be stored in the keystore
66+
are marked as `Secure`.
6567

66-
[source,yaml]
67-
----
68-
cloud:
69-
aws:
70-
s3:
71-
proxy:
72-
host: proxy1.company.com
73-
port: 8083
74-
username: myself1
75-
password: theBestPasswordEver1!
76-
ec2:
77-
proxy:
78-
host: proxy2.company.com
79-
port: 8083
80-
username: myself2
81-
password: theBestPasswordEver2!
82-
----
68+
`access_key`::
8369

84-
===== Read timeout
70+
An s3 access key. The `secret_key` setting must also be specified. (Secure)
8571

86-
Read timeout determines the amount of time to wait for data to be transferred over an established,
87-
open connection before the connection is timed out. Defaults to AWS SDK default value (`50s`).
88-
It can be configured with `cloud.aws.read_timeout` (or `cloud.aws.s3.read_timeout`) setting:
72+
`secret_key`::
8973

90-
[source, yaml]
91-
----
92-
cloud.aws.read_timeout: 30s
93-
----
74+
An s3 secret key. The `access_key` setting must also be specified. (Secure)
75+
76+
`endpoint`::
77+
78+
The s3 service endpoint to connect to. This will be automatically
79+
figured out by the s3 client based on the bucket location, but
80+
can be specified explicitly. See http://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region.
81+
82+
`protocol`::
83+
84+
The protocol to use to connect to s3. Valid values are either `http`
85+
or `https`. Defaults to `https`.
86+
87+
`proxy.host`::
88+
89+
The host name of a proxy to connect to s3 through.
90+
91+
`proxy.port`::
92+
93+
The port of a proxy to connect to s3 through.
94+
95+
`proxy.username`::
96+
97+
The username to connect to the `proxy.host` with. (Secure)
98+
99+
`proxy.password`::
100+
101+
The password to connect to the `proxy.host` with. (Secure)
102+
103+
`read_timeout`::
104+
105+
The socket timeout for connecting to s3. The value should specify the unit. For example,
106+
a value of `5s` specifies a 5 second timeout. The default value is 50 seconds.
107+
108+
`max_retries`::
109+
110+
The number of retries to use when an s3 request fails. The default value is 3.
111+
112+
`use_throttle_retries`::
113+
114+
Whether retries should be throttled (ie use backoff). Must be `true` or `false`. Defaults to `false`.
94115

95116
[[repository-s3-repository]]
96-
==== S3 Repository
117+
==== Repository Settings
97118

98-
The S3 repository is using S3 to store snapshots. The S3 repository can be created using the following command:
119+
The `s3` repository type supports a number of settings to customize how data is stored in S3.
120+
These can be specified when creating the repository. For example:
99121

100122
[source,js]
101123
----
102124
PUT _snapshot/my_s3_repository
103125
{
104126
"type": "s3",
105127
"settings": {
106-
"bucket": "my_bucket_name"
128+
"bucket": "my_bucket_name",
129+
"another_setting": "setting_value"
107130
}
108131
}
109132
----
@@ -116,15 +139,9 @@ The following settings are supported:
116139

117140
The name of the bucket to be used for snapshots. (Mandatory)
118141

119-
`endpoint`::
120-
121-
The endpoint for the S3 region in which the bucket exists. The default S3 endpoint
122-
will automatically find the region of the configured bucket and forward to there.
142+
`client`::
123143

124-
`protocol`::
125-
126-
The protocol to use (`http` or `https`). Defaults to value of
127-
`cloud.aws.protocol` or `cloud.aws.s3.protocol`.
144+
The name of the s3 client to use to connect to S3. Defaults to `default`.
128145

129146
`base_path`::
130147

@@ -134,16 +151,6 @@ The following settings are supported:
134151
However, this has been deprecated and setting the base_path now should
135152
omit the leading `/`.
136153

137-
`access_key`::
138-
139-
The access key to use for authentication. Defaults to value of
140-
`cloud.aws.access_key`.
141-
142-
`secret_key`::
143-
144-
The secret key to use for authentication. Defaults to value of
145-
`cloud.aws.secret_key`.
146-
147154
`chunk_size`::
148155

149156
Big files can be broken down into chunks during snapshotting if needed.
@@ -172,18 +179,6 @@ The following settings are supported:
172179
Multipart API and may result in upload errors. Defaults to the minimum
173180
between `100mb` and `5%` of the heap size.
174181

175-
`max_retries`::
176-
177-
Number of retries in case of S3 errors. Defaults to `3`.
178-
179-
`use_throttle_retries`::
180-
181-
Set to `true` if you want to throttle retries. Defaults to AWS SDK default value (`false`).
182-
183-
`readonly`::
184-
185-
Makes repository read-only. Defaults to `false`.
186-
187182
`canned_acl`::
188183

189184
The S3 repository supports all http://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html#canned-acl[S3 canned ACLs]
@@ -200,22 +195,6 @@ The following settings are supported:
200195
currently supported by the plugin. For more information about the
201196
different classes, see http://docs.aws.amazon.com/AmazonS3/latest/dev/storage-class-intro.html[AWS Storage Classes Guide]
202197

203-
`path_style_access`::
204-
205-
Activate path style access for http://docs.aws.amazon.com/AmazonS3/latest/dev/VirtualHosting.html[virtual hosting of buckets].
206-
The default behaviour is to detect which access style to use based on the configured endpoint (an IP will result
207-
in path-style access) and the bucket being accessed (some buckets are not valid DNS names).
208-
209-
Note that you can define S3 repository settings for all S3 repositories in `elasticsearch.yml` configuration file.
210-
They are all prefixed with `repositories.s3.`. For example, you can define compression for all S3 repositories
211-
by setting `repositories.s3.compress: true` in `elasticsearch.yml`.
212-
213-
The S3 repositories use the same credentials as the rest of the AWS services
214-
provided by this plugin (`discovery`). See <<repository-s3-usage>> for details.
215-
216-
Multiple S3 repositories can be created. If the buckets require different
217-
credentials, then define them as part of the repository settings.
218-
219198
[[repository-s3-permissions]]
220199
===== Recommended S3 Permissions
221200

@@ -321,15 +300,6 @@ specific bucket like this:
321300
----
322301
// NOTCONSOLE
323302

324-
[[repository-s3-endpoint]]
325-
===== Using other S3 endpoint
326-
327-
If you are using any S3 api compatible service, you can set a global endpoint by setting `cloud.aws.s3.endpoint`
328-
to your URL provider. Note that this setting will be used for all S3 repositories.
329-
330-
Different `endpoint` and `protocol` settings can be set on a per-repository basis
331-
See <<repository-s3-repository>> for details.
332-
333303
[[repository-s3-aws-vpc]]
334304
[float]
335305
==== AWS VPC Bandwidth Settings

0 commit comments

Comments
 (0)