# gce plugin with private access

**URL:** <https://discuss.elastic.co/t/gce-plugin-with-private-access/364492>\
**Category:** Elasticsearch\
**Created:** [August 6, 2024, 4:57pm UTC](https://discuss.elastic.co/t/gce-plugin-with-private-access/364492 "2024-08-06T16:57:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![vaboston](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vaboston/32/136579_2.png) [@vaboston](https://discuss.elastic.co/u/vaboston)\
**Post date:** [August 6, 2024, 4:57pm UTC](https://discuss.elastic.co/t/gce-plugin-with-private-access/364492/1 "2024-08-06T16:57:04Z")

</div>

Hello,  
I'm using GCE discovery plugin on GCP VM, and i don't have nat gateway to join metadata.google.internal. I activated private access on my subnet and now i can use [private.googleapis.com](http://private.googleapis.com) to ask metadata. But gce-disocvery send me :

```auto
Problem fetching instance list for zone europe-west1-c
java.net.SocketTimeoutException: Connect timed out

```

and tcpdump show me the outgoing request from plugin :

```auto
GET /computeMetadata/v1/instance/network-interfaces/0/ip HTTP/1.1
Accept-Encoding: gzip
User-Agent: Google-HTTP-Java-Client/1.44.1 (gzip)
metadata-flavor: Google
Host: metadata.google.internal

```

I tried to add in my /etc/hosts :

```auto
199.36.153.11 metadata.google.internal //199.36.153.11 is IP for private.googleapis.com

```

but now i have 401 return code.  
So, is there a way to use the plugin in private access ?  
Thanks

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [August 6, 2024, 8:30pm UTC](https://discuss.elastic.co/t/gce-plugin-with-private-access/364492/2 "2024-08-06T20:30:13Z")

</div>

Welcome!

As I answered on slack, I'm wondering if there's a way with this

> <https://github.com/elastic/elasticsearch/blob/10b51179f97e493d38f3e81b71a429188df74ec9/plugins/discovery-gce/src/main/java/org/elasticsearch/plugin/discovery/gce/GceDiscoveryPlugin.java#L105>

And

> <https://github.com/elastic/elasticsearch/blob/10b51179f97e493d38f3e81b71a429188df74ec9/plugins/discovery-gce/src/main/java/org/elasticsearch/plugin/discovery/gce/GceDiscoveryPlugin.java#L46>

It's supposed to be for tests only. But may be it would work...

---

<div class="post-metadata">

**Author:** ![vaboston](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vaboston/32/136579_2.png) [@vaboston](https://discuss.elastic.co/u/vaboston)\
**Post date:** [August 7, 2024, 8:44am UTC](https://discuss.elastic.co/t/gce-plugin-with-private-access/364492/3 "2024-08-07T08:44:15Z")

</div>

I didn't manage to pass the allow\_reroute\_gce\_settings option but it doesn't matter, I'll do it differently, thank you for your time
