You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Make it clear that automatic default credentials (ADC)
is not supported for the repository-gcs plugin.
"Service Account" method is the only alternative
to authn requests to Google Cloud Storage.
The plugin uses the https://cloud.google.com/storage/docs/json_api/[Google Cloud Storage JSON API] (v1)
14
-
to connect to the Storage service. If this is the first time you use Google Cloud Storage, you first
15
-
need to connect to the https://console.cloud.google.com/[Google Cloud Platform Console] and create a new
16
-
project. Once your project is created, you must enable the Cloud Storage Service for your project.
13
+
The plugin uses the https://github.com/GoogleCloudPlatform/google-cloud-java/tree/master/google-cloud-clients/google-cloud-storage[Google Cloud Java Client for Storage]
14
+
to connect to the Storage service. If you are using
15
+
https://cloud.google.com/storage/[Google Cloud Storage] for the first time, you
16
+
must connect to the https://console.cloud.google.com/[Google Cloud Platform Console]
17
+
and create a new project. After your project is created, you must enable the
18
+
Cloud Storage Service for your project.
17
19
18
20
[[repository-gcs-creating-bucket]]
19
21
===== Creating a Bucket
20
22
21
-
Google Cloud Storage service uses the concept of https://cloud.google.com/storage/docs/key-terms[Bucket]
22
-
as a container for all the data. Buckets are usually created using the
23
-
https://console.cloud.google.com/[Google Cloud Platform Console]. The plugin will not automatically
24
-
create buckets.
23
+
The Google Cloud Storage service uses the concept of a
24
+
https://cloud.google.com/storage/docs/key-terms[bucket] as a container for all
25
+
the data. Buckets are usually created using the
26
+
https://console.cloud.google.com/[Google Cloud Platform Console]. The plugin
27
+
does not automatically create buckets.
25
28
26
29
To create a new bucket:
27
30
28
-
1. Connect to the https://console.cloud.google.com/[Google Cloud Platform Console]
29
-
2. Select your project
30
-
3. Go to the https://console.cloud.google.com/storage/browser[Storage Browser]
31
-
4. Click the "Create Bucket" button
32
-
5. Enter the name of the new bucket
33
-
6. Select a storage class
34
-
7. Select a location
35
-
8. Click the "Create" button
31
+
1. Connect to the https://console.cloud.google.com/[Google Cloud Platform Console].
32
+
2. Select your project.
33
+
3. Go to the https://console.cloud.google.com/storage/browser[Storage Browser].
This is the default authentication mode and requires no configuration.
57
-
58
-
NOTE: The Compute Engine VM must be allowed to use the Storage service. This can be done only at VM
59
-
creation time, when "Storage" access can be configured to "Read/Write" permission. Check your
60
-
instance details at the section "Cloud API access scopes".
46
+
The plugin must authenticate the requests it makes to the Google Cloud Storage
47
+
service. It is common for Google client libraries to employ a strategy named https://cloud.google.com/docs/authentication/production#providing_credentials_to_your_application[application default credentials].
48
+
However, that strategy is **not** supported for use with Elasticsearch. The
49
+
plugin operates under the Elasticsearch process, which runs with the security
50
+
manager enabled. The security manager obstructs the "automatic" credential discovery.
51
+
Therefore, you must configure <<repository-gcs-using-service-account,service account>>
52
+
credentials even if you are using an environment that does not normally require
53
+
this configuration (such as Compute Engine, Kubernetes Engine or App Engine).
61
54
62
55
[[repository-gcs-using-service-account]]
63
56
===== Using a Service Account
64
-
If your Elasticsearch node is not running on Compute Engine, or if you don't want to use Google's
65
-
built-in authentication mechanism, you can authenticate on the Storage service using a
You have to obtain and provide https://cloud.google.com/iam/docs/overview#service_account[service account credentials]
58
+
manually.
59
+
60
+
For detailed information about generating JSON service account files, see the https://cloud.google.com/storage/docs/authentication?hl=en#service_accounts[Google Cloud documentation].
61
+
Note that the PKCS12 format is not supported by this plugin.
67
62
68
-
To create a service account file:
63
+
Here is a summary of the steps:
69
64
70
-
1. Connect to the https://console.cloud.google.com/[Google Cloud Platform Console]
71
-
2. Select your project
72
-
3. Got to the https://console.cloud.google.com/permissions[Permission] tab
73
-
4. Select the https://console.cloud.google.com/permissions/serviceaccounts[Service Accounts] tab
74
-
5. Click on "Create service account"
75
-
6. Once created, select the new service account and download a JSON key file
65
+
1. Connect to the https://console.cloud.google.com/[Google Cloud Platform Console].
66
+
2. Select your project.
67
+
3. Got to the https://console.cloud.google.com/permissions[Permission] tab.
68
+
4. Select the https://console.cloud.google.com/permissions/serviceaccounts[Service Accounts] tab.
69
+
5. Click *Create service account*.
70
+
6. After the account is created, select it and download a JSON key file.
76
71
77
-
A service account file looks like this:
72
+
A JSON service account file looks like this:
78
73
79
74
[source,js]
80
75
----
@@ -84,19 +79,26 @@ A service account file looks like this:
This file must be stored in the {ref}/secure-settings.html[elasticsearch keystore], under a setting name
93
-
of the form `gcs.client.NAME.credentials_file`, where `NAME` is the name of the client configuration.
94
-
The default client name is `default`, but a different client name can be specified in repository
95
-
settings using `client`.
91
+
To provide this file to the plugin, it must be stored in the {ref}/secure-settings.html[Elasticsearch keystore]. You must add a setting name of the form `gcs.client.NAME.credentials_file`, where `NAME`
92
+
is the name of the client configuration for the repository. The implicit client
93
+
name is `default`, but a different client name can be specified in the
94
+
repository settings with the `client` key.
96
95
97
-
For example, if specifying the credentials file in the keystore under
98
-
`gcs.client.my_alternate_client.credentials_file`, you can configure a repository to use these
99
-
credentials like this:
96
+
NOTE: Passing the file path via the GOOGLE_APPLICATION_CREDENTIALS environment
97
+
variable is **not** supported.
98
+
99
+
For example, if you added a `gcs.client.my_alternate_client.credentials_file`
100
+
setting in the keystore, you can configure a repository to use those credentials
101
+
like this:
100
102
101
103
[source,js]
102
104
----
@@ -113,19 +115,18 @@ PUT _snapshot/my_gcs_repository
113
115
// TEST[skip:we don't have gcs setup while testing this]
114
116
115
117
The `credentials_file` settings are {ref}/secure-settings.html#reloadable-secure-settings[reloadable].
116
-
After you reload the settings, the internal `gcs` clients, used to transfer the
117
-
snapshot contents, will utilize the latest settings from the keystore.
118
-
118
+
After you reload the settings, the internal `gcs` clients, which are used to
119
+
transfer the snapshot contents, utilize the latest settings from the keystore.
119
120
120
-
NOTE: In progress snapshot/restore jobs will not be preempted by a *reload*
121
-
of the client's `credentials_file` settings. They will complete using the client
122
-
as it was built when the operation started.
121
+
NOTE: Snapshot or restore jobs that are in progress are not preempted by a *reload*
122
+
of the client's `credentials_file` settings. They complete using the client as
123
+
it was built when the operation started.
123
124
124
125
[[repository-gcs-client]]
125
126
==== Client Settings
126
127
127
128
The client used to connect to Google Cloud Storage has a number of settings available.
128
-
Client setting names are of the form `gcs.client.CLIENT_NAME.SETTING_NAME` and specified
129
+
Client setting names are of the form `gcs.client.CLIENT_NAME.SETTING_NAME` and are specified
129
130
inside `elasticsearch.yml`. The default client name looked up by a `gcs` repository is
130
131
called `default`, but can be customized with the repository setting `client`.
131
132
@@ -146,7 +147,7 @@ PUT _snapshot/my_gcs_repository
146
147
// TEST[skip:we don't have gcs setup while testing this]
147
148
148
149
Some settings are sensitive and must be stored in the
149
-
{ref}/secure-settings.html[elasticsearch keystore]. This is the case for the service account file:
150
+
{ref}/secure-settings.html[Elasticsearch keystore]. This is the case for the service account file:
150
151
151
152
[source,sh]
152
153
----
@@ -185,7 +186,7 @@ are marked as `Secure`.
185
186
186
187
`project_id`::
187
188
188
-
The Google Cloud project id. This will be automatically infered from the credentials file but
189
+
The Google Cloud project id. This will be automatically inferred from the credentials file but
189
190
can be specified explicitly. For example, it can be used to switch between projects when the
190
191
same credentials are usable for both the production and the development projects.
191
192
@@ -248,8 +249,8 @@ The following settings are supported:
248
249
249
250
The service account used to access the bucket must have the "Writer" access to the bucket:
250
251
251
-
1. Connect to the https://console.cloud.google.com/[Google Cloud Platform Console]
252
-
2. Select your project
253
-
3. Got to the https://console.cloud.google.com/storage/browser[Storage Browser]
254
-
4. Select the bucket and "Edit bucket permission"
255
-
5. The service account must be configured as a "User" with "Writer" access
252
+
1. Connect to the https://console.cloud.google.com/[Google Cloud Platform Console].
253
+
2. Select your project.
254
+
3. Got to the https://console.cloud.google.com/storage/browser[Storage Browser].
255
+
4. Select the bucket and "Edit bucket permission".
256
+
5. The service account must be configured as a "User" with "Writer" access.
0 commit comments