# Heartbeat issue : Bad Gateway: couldn't connect to any of the configured Elasticsearch hosts

**URL:** https://discuss.elastic.co/t/heartbeat-issue-bad-gateway-couldnt-connect-to-any-of-the-configured-elasticsearch-hosts/321270
**Category:** Beats
**Tags:** heartbeat
**Created:** [December 15, 2022, 8:18am UTC](https://discuss.elastic.co/t/heartbeat-issue-bad-gateway-couldnt-connect-to-any-of-the-configured-elasticsearch-hosts/321270 "2022-12-15T08:18:17Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![aji.shinde7](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aji.shinde7/32/115498_2.png) [@aji.shinde7](https://discuss.elastic.co/u/aji.shinde7)
#### Post date: [December 15, 2022, 8:18am UTC](https://discuss.elastic.co/t/heartbeat-issue-bad-gateway-couldnt-connect-to-any-of-the-configured-elasticsearch-hosts/321270/1 "2022-12-15T08:18:17Z")

</div>

Hello Experts,

I am having issue to connect Heartbeat to Elasticsearch instance (Cloud).

Background:

I have a Linux server, Heartbeat Version 7.5.0 is running on it and sending Data to Elasticsearch instance (Cloud).  
But that Data is not picked up by Alerts (Rules) and clients don't get any alert email.

Elastic Cloud Instance is of latest version.

so to resolve this issue, I stopped Heartbeat Service for Version 7.5.0 and installed Heartbeat Version 7.16.3 on Linux server but it shows below error,

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/1/0/10003496db3ff644307697dd53c881777755211c.png)

Expecting solutions from you experts 🙂

---

<div class="post-metadata">

### Author: ![emilioalvap](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/emilioalvap/32/99310_2.png) [@emilioalvap](https://discuss.elastic.co/u/emilioalvap)
#### Post date: [December 15, 2022, 12:00pm UTC](https://discuss.elastic.co/t/heartbeat-issue-bad-gateway-couldnt-connect-to-any-of-the-configured-elasticsearch-hosts/321270/2 "2022-12-15T12:00:54Z")

</div>

Hi @aji.shinde7,

There're serveral ways of connecting to an Elastic Cloud instance, can you please let us know whether you're setting the host directly in `output.elasticsearch.hosts` or using a combination of `cloud.id`/`cloud.auth`?

There shouldn't be an incompatibility so I'd recommend testing using `cloud.id` and `cloud.auth` as they are the [preferred](https://www.elastic.co/guide/en/beats/heartbeat/current/configure-cloud-id.html#configure-cloud-id) way to connect to cloud.

```auto
cloud.id: "<deployment id>"
cloud.auth: "<cloud auth>"

```

---

<div class="post-metadata">

### Author: ![aji.shinde7](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aji.shinde7/32/115498_2.png) [@aji.shinde7](https://discuss.elastic.co/u/aji.shinde7)
#### Post date: [December 15, 2022, 12:25pm UTC](https://discuss.elastic.co/t/heartbeat-issue-bad-gateway-couldnt-connect-to-any-of-the-configured-elasticsearch-hosts/321270/3 "2022-12-15T12:25:29Z")

</div>

Hi emilioalvap,

I am using `cloud.id` and `cloud.auth`. Tried with 'output.elasticsearch.hosts ' as well. I am confused on using double quotes (") and certificate with extension ".pem"

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/5/7/5720d60ab590e9a74345dcf2d2eab9ae14d5da82.png)

I there something to do with SSL/TLS ?

---

<div class="post-metadata">

### Author: ![emilioalvap](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/emilioalvap/32/99310_2.png) [@emilioalvap](https://discuss.elastic.co/u/emilioalvap)
#### Post date: [December 15, 2022, 3:14pm UTC](https://discuss.elastic.co/t/heartbeat-issue-bad-gateway-couldnt-connect-to-any-of-the-configured-elasticsearch-hosts/321270/4 "2022-12-15T15:14:28Z")

</div>

Hi @aji.shinde7,

Config seems correct, it doesn't seem like the error would be related to heartbeat specifically.

Since this is happening on Elastic Cloud, could you open a [support request](https://cloud.elastic.co/help) for cloud team? They will be able to ascertain that all infrastructure elements are working correctly and. if needed be, reach out to us with more information.

---

<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: [January 12, 2023, 5:14pm UTC](https://discuss.elastic.co/t/heartbeat-issue-bad-gateway-couldnt-connect-to-any-of-the-configured-elasticsearch-hosts/321270/5 "2023-01-12T17:14:50Z")

</div>

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