# Metricbeat kept connecting to http://localhost:9200 while using AWS privatelink

**URL:** <https://discuss.elastic.co/t/metricbeat-kept-connecting-to-http-localhost-9200-while-using-aws-privatelink/327634>\
**Category:** Metrics\
**Created:** [March 14, 2023, 8:30am UTC](https://discuss.elastic.co/t/metricbeat-kept-connecting-to-http-localhost-9200-while-using-aws-privatelink/327634 "2023-03-14T08:30:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tanwk2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tanwk2/32/94711_2.png) [@tanwk2](https://discuss.elastic.co/u/tanwk2)\
**Post date:** [March 14, 2023, 8:30am UTC](https://discuss.elastic.co/t/metricbeat-kept-connecting-to-http-localhost-9200-while-using-aws-privatelink/327634/1 "2023-03-14T08:30:21Z")

</div>

Anyone has the same problem where the Metricbeats keep trying to connect to Elasticsearch Url: [http://localhost:9200](http://localhost:9200) until around 1h 30 mins later and it finds the correct Elasticsearch Url that was identified in the fleet settings.

```auto
{"log.level":"error","@timestamp":"2023-03-06T04:55:12.781Z","log.logger":"publisher_pipeline_output","log.origin":{"file.name":"pipeline/client_worker.go","file.line":150},"message":"Failed to connect to backoff(elasticsearch(http://localhost:9200)): Get \"http://localhost:9200\": dial tcp 127.0.0.1:9200: connect: connection refused","service.name":"metricbeat","ecs.version":"1.6.0"}
{"log.level":"info","@timestamp":"2023-03-06T04:55:12.781Z","log.logger":"publisher_pipeline_output","log.origin":{"file.name":"pipeline/client_worker.go","file.line":141},"message":"Attempting to reconnect to backoff(elasticsearch(http://localhost:9200)) with 126 reconnect attempt(s)","service.name":"metricbeat","ecs.version":"1.6.0"}

```

The entire setup is using traffic filter via AWS private link and using fleet managed elastic agent.

---

<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:** [April 11, 2023, 8:30am UTC](https://discuss.elastic.co/t/metricbeat-kept-connecting-to-http-localhost-9200-while-using-aws-privatelink/327634/2 "2023-04-11T08:30:41Z")

</div>

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