# Elasticsearch cannot connect to the Remote Server

**URL:** <https://discuss.elastic.co/t/elasticsearch-cannot-connect-to-the-remote-server/359915>\
**Category:** Elasticsearch\
**Created:** [May 21, 2024, 11:01am UTC](https://discuss.elastic.co/t/elasticsearch-cannot-connect-to-the-remote-server/359915 "2024-05-21T11:01:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Akila\_P](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/akila_p/32/134685_2.png) [@Akila\_P](https://discuss.elastic.co/u/Akila_P)\
**Post date:** [May 21, 2024, 11:01am UTC](https://discuss.elastic.co/t/elasticsearch-cannot-connect-to-the-remote-server/359915/1 "2024-05-21T11:01:25Z")

</div>

**When using Localhost**

```auto
root@ip-172-16-0-102:/etc/elasticsearch# curl localhost:9200
{
  "name" : "ip-172-16-0-102",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "xXGFhvjvR_qbJK_oC0YPSg",
  "version" : {
    "number" : "8.13.4",
    "build_flavor" : "default",
    "build_type" : "deb",
    "build_hash" : "da95df118650b55a500dcc181889ac35c6d8da7c",
    "build_date" : "2024-05-06T22:04:45.107454559Z",
    "build_snapshot" : false,
    "lucene_version" : "9.10.0",
    "minimum_wire_compatibility_version" : "7.17.0",
    "minimum_index_compatibility_version" : "7.0.0"
  },
  "tagline" : "You Know, for Search"
}

```

**When using ec2 public ip**

```auto
root@ip-172-16-0-102:/etc/elasticsearch# curl xx.xxx.xxx.xxx:9200
curl: (7) Failed to connect to xx.xxx.xxx.xxx port 9200 after 3 ms: Couldn't connect to server

```

**My Config**

 ![Screenshot 2024-05-21 155833](https://us1.discourse-cdn.com/elastic/original/3X/0/e/0ef2f4bb312f02bf2d81571b5c178751a19340ac.png)

---

<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:** [May 21, 2024, 11:22am UTC](https://discuss.elastic.co/t/elasticsearch-cannot-connect-to-the-remote-server/359915/2 "2024-05-21T11:22:23Z")

</div>

Please don't post images of text as they are hard to read, may not display correctly for everyone, and are not searchable.

Instead, paste the text and format it with `</>` icon or pairs of triple backticks (```), and check the preview window to make sure it's properly formatted before posting it. This makes it more likely that your question will receive a useful answer.

It would be great if you could update your post to solve this.

Also please share the full logs.
