# Cannot connect to elastic cluster on VPN machine

**URL:** https://discuss.elastic.co/t/cannot-connect-to-elastic-cluster-on-vpn-machine/309848
**Category:** Elasticsearch
**Created:** [July 18, 2022, 6:55am UTC](https://discuss.elastic.co/t/cannot-connect-to-elastic-cluster-on-vpn-machine/309848 "2022-07-18T06:55:44Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Michal\_Bogusz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/michal_bogusz/32/101718_2.png) [@Michal\_Bogusz](https://discuss.elastic.co/u/Michal_Bogusz)
#### Post date: [July 18, 2022, 6:55am UTC](https://discuss.elastic.co/t/cannot-connect-to-elastic-cluster-on-vpn-machine/309848/1 "2022-07-18T06:55:44Z")

</div>

Hi, I am new to Elasticsearch. What I managed to do so far is to bring up ElasticSearch container and successfully connect to it using both http connection(via Postman) and using python client.

However, now I want to bring up such a container not on my machine. And I managed to bring this machine up and connect using http call. But when I try to connect through python client I get this error:

```auto
elastic_transport.TlsError: TLS error caused by: TlsError(TLS error caused by: SSLError(hostname '34.116. ***.***' doesn't match either of 'localhost', '172.19.0.2', '127.0.0.1', 'bde723133f75'))

```

How I connect:

```auto
   es = Elasticsearch(
        https://34.116. ***.*** :9200",
        ca_certs=cert.crt,
        basic_auth=(elastic_user, elastic_password),
    )

```

Error occurres on this line `res = es.search(index="pdf-documents", query=query)`

---

<div class="post-metadata">

### Author: ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)
#### Post date: [July 18, 2022, 7:35am UTC](https://discuss.elastic.co/t/cannot-connect-to-elastic-cluster-on-vpn-machine/309848/2 "2022-07-18T07:35:19Z")

</div>

Welcome to our community! 😃

What are your Elasticsearch and docker config?

---

<div class="post-metadata">

### Author: ![Michal\_Bogusz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/michal_bogusz/32/101718_2.png) [@Michal\_Bogusz](https://discuss.elastic.co/u/Michal_Bogusz)
#### Post date: [July 18, 2022, 7:43am UTC](https://discuss.elastic.co/t/cannot-connect-to-elastic-cluster-on-vpn-machine/309848/3 "2022-07-18T07:43:47Z")

</div>

I am using docker-compose:

```auto
  elastic:
    container_name: elastic
    image:
      docker.elastic.co/elasticsearch/elasticsearch:8.3.2
    ports:
      - "9200:9200"
      - "9300:9300"

```

And I did not configure anything more in Elastichsearch just copied cert and resetted password

---

<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 15, 2022, 7:43am UTC](https://discuss.elastic.co/t/cannot-connect-to-elastic-cluster-on-vpn-machine/309848/4 "2022-08-15T07:43:59Z")

</div>

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