# Error to setup Google Cloud Storage service auth

**URL:** <https://discuss.elastic.co/t/error-to-setup-google-cloud-storage-service-auth/142823>\
**Category:** Elasticsearch\
**Created:** [August 2, 2018, 11:34pm UTC](https://discuss.elastic.co/t/error-to-setup-google-cloud-storage-service-auth/142823 "2018-08-02T23:34:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![gutiago](https://avatars.discourse-cdn.com/v4/letter/g/f04885/32.png) [@gutiago](https://discuss.elastic.co/u/gutiago)\
**Post date:** [August 2, 2018, 11:34pm UTC](https://discuss.elastic.co/t/error-to-setup-google-cloud-storage-service-auth/142823/1 "2018-08-02T23:34:19Z")

</div>

Hello!

I'm trying to configure the service auth of my Google Cloud bucket on Elasticsearch. My intention is to create a snapshot of my cluster in the bucket.  
I'm following this tutorial from the [Elastic documentation](https://www.elastic.co/guide/en/elasticsearch/plugins/6.1/repository-gcs-usage.html#repository-gcs-using-compute-engine).

But I'm getting stuck on the part that I must store the .json file with **elasticsearch keystore**. I have created a custom elasticsearch docker image to install the gcs plugin and also copy the credential file to my container.

On my docker file, I call a custom script to perform the process describe above. So my .sh file has this peace of code:

`/usr/share/elasticsearch/bin/elasticsearch-plugin install repository-gcs`

`cat /usr/share/elasticsearch/config/my_certificate_gcs.json | /usr/share/elasticsearch/bin/elasticsearch-keystore add --stdin gcs.client.default.credentials_file`

The second part is related to the tutorial I'm following to... But when I try to run the pod (I'm using Kubernetes), I gives me the following error:

```
[2018-08-02T23:27:12,608][WARN][o.e.b.ElasticsearchUncaughtExceptionHandler] [es-data-6f7797fcb5-wqvr8] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: java.lang.IllegalStateException: failed to load plugin class [org.elasticsearch.repositories.gcs.GoogleCloudStoragePlugin]
	at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:125) ~[elasticsearch-6.1.3.jar:6.1.3]
	at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:112) ~[elasticsearch-6.1.3.jar:6.1.3]
	at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) ~[elasticsearch-6.1.3.jar:6.1.3]
	at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124) ~[elasticsearch-cli-6.1.3.jar:6.1.3]
	at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-cli-6.1.3.jar:6.1.3]
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:92) ~[elasticsearch-6.1.3.jar:6.1.3]
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:85) ~[elasticsearch-6.1.3.jar:6.1.3]
Caused by: java.lang.IllegalStateException: failed to load plugin class [org.elasticsearch.repositories.gcs.GoogleCloudStoragePlugin]
	at org.elasticsearch.plugins.PluginsService.loadPlugin(PluginsService.java:452) ~[elasticsearch-6.1.3.jar:6.1.3]
	at org.elasticsearch.plugins.PluginsService.loadBundles(PluginsService.java:392) ~[elasticsearch-6.1.3.jar:6.1.3]
	at org.elasticsearch.plugins.PluginsService.<init>(PluginsService.java:142) ~[elasticsearch-6.1.3.jar:6.1.3]
	at org.elasticsearch.node.Node.<init>(Node.java:302) ~[elasticsearch-6.1.3.jar:6.1.3]
	at org.elasticsearch.node.Node.<init>(Node.java:245) ~[elasticsearch-6.1.3.jar:6.1.3]
	at org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:212) ~[elasticsearch-6.1.3.jar:6.1.3]
	at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:212) ~[elasticsearch-6.1.3.jar:6.1.3]
	at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:322) ~[elasticsearch-6.1.3.jar:6.1.3]
	at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:121) ~[elasticsearch-6.1.3.jar:6.1.3]
	... 6 more
Caused by: java.lang.IllegalStateException: Secret setting gcs.client.default.credentials_file is not a file
	at org.elasticsearch.common.settings.KeyStoreWrapper.getFile(KeyStoreWrapper.java:365) ~[elasticsearch-6.1.3.jar:6.1.3]
	at org.elasticsearch.common.settings.SecureSetting$SecureFileSetting.getSecret(SecureSetting.java:192) ~[elasticsearch-6.1.3.jar:6.1.3]
	at org.elasticsearch.common.settings.SecureSetting$SecureFileSetting.getSecret(SecureSetting.java:182) ~[elasticsearch-6.1.3.jar:6.1.3]
	at org.elasticsearch.common.settings.SecureSetting.get(SecureSetting.java:93) ~[elasticsearch-6.1.3.jar:6.1.3]
	at org.elasticsearch.repositories.gcs.GoogleCloudStorageService.loadClientCredentials(GoogleCloudStorageService.java:168) ~[?:?]
	at org.elasticsearch.repositories.gcs.GoogleCloudStoragePlugin.<init>(GoogleCloudStoragePlugin.java:118) ~[?:?]
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:?]
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:?]
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:?]
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_161]
	at org.elasticsearch.plugins.PluginsService.loadPlugin(PluginsService.java:445) ~[elasticsearch-6.1.3.jar:6.1.3]
	at org.elasticsearch.plugins.PluginsService.loadBundles(PluginsService.java:392) ~[elasticsearch-6.1.3.jar:6.1.3]
	at org.elasticsearch.plugins.PluginsService.<init>(PluginsService.java:142) ~[elasticsearch-6.1.3.jar:6.1.3]
	at org.elasticsearch.node.Node.<init>(Node.java:302) ~[elasticsearch-6.1.3.jar:6.1.3]
	at org.elasticsearch.node.Node.<init>(Node.java:245) ~[elasticsearch-6.1.3.jar:6.1.3]
	at org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:212) ~[elasticsearch-6.1.3.jar:6.1.3]
	at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:212) ~[elasticsearch-6.1.3.jar:6.1.3]
	at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:322) ~[elasticsearch-6.1.3.jar:6.1.3]
	at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:121) ~[elasticsearch-6.1.3.jar:6.1.3]
	... 6 more

```

If I remove `cat /usr/share/elasticsearch/config/my_certificate_gcs.json | /usr/share/elasticsearch/bin/elasticsearch-keystore add --stdin gcs.client.default.credentials_file`, the service starts with no problem.

Does anyone know how I can solve this problem or point me to a solution in the docs?

---

<div class="post-metadata">

**Author:** ![gutiago](https://avatars.discourse-cdn.com/v4/letter/g/f04885/32.png) [@gutiago](https://discuss.elastic.co/u/gutiago)\
**Post date:** [August 3, 2018, 1:20pm UTC](https://discuss.elastic.co/t/error-to-setup-google-cloud-storage-service-auth/142823/2 "2018-08-03T13:20:50Z")

</div>

So I figured it out... The problem was related to the way I was adding the json file to keystore.  
This is the right form:

`/usr/share/elasticsearch/bin/elasticsearch-keystore add-file gcs.client.default.credentials_file /gcs/my_file.json`

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [August 31, 2018, 1:20pm UTC](https://discuss.elastic.co/t/error-to-setup-google-cloud-storage-service-auth/142823/3 "2018-08-31T13:20:57Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
