# Unable to remotely access ES server hosted on AWS EC2 on port 9200

**URL:** <https://discuss.elastic.co/t/unable-to-remotely-access-es-server-hosted-on-aws-ec2-on-port-9200/33243>\
**Category:** Elasticsearch\
**Created:** [October 29, 2015, 12:29pm UTC](https://discuss.elastic.co/t/unable-to-remotely-access-es-server-hosted-on-aws-ec2-on-port-9200/33243 "2015-10-29T12:29:31Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zaid\_Amir](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zaid_amir/32/54679_2.png) [@Zaid\_Amir](https://discuss.elastic.co/u/Zaid_Amir)\
**Post date:** [October 29, 2015, 12:29pm UTC](https://discuss.elastic.co/t/unable-to-remotely-access-es-server-hosted-on-aws-ec2-on-port-9200/33243/1 "2015-10-29T12:29:31Z")

</div>

Hi,

I upgraded an existing 1.7 installation to 2.0 and installed marvel and kibana on the same server.  
By SSHing to the server and doing curl command I am able to index, search and do everything possible on the cluster with no issues.

However, when I try and send a request from a remote computer I get a 502 "Connection Refused" error on port 9200.

I am able to access both Marvel and Kibana remotely on port 5601 with no issues yet ES is not allowing me to access it remotely.

The node is hosted on Amazon's EC2 and I have both ports 5601 and 9200 open in the group policy.

Is there something I need to do to enable remote connections on 2.0?

---

<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:** [October 29, 2015, 12:56pm UTC](https://discuss.elastic.co/t/unable-to-remotely-access-es-server-hosted-on-aws-ec2-on-port-9200/33243/2 "2015-10-29T12:56:47Z")

</div>

By default, elasticsearch now binds to 127.0.0.1.

If you need to open it, change "network.host".

David

---

<div class="post-metadata">

**Author:** ![Zaid\_Amir](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zaid_amir/32/54679_2.png) [@Zaid\_Amir](https://discuss.elastic.co/u/Zaid_Amir)\
**Post date:** [October 29, 2015, 1:24pm UTC](https://discuss.elastic.co/t/unable-to-remotely-access-es-server-hosted-on-aws-ec2-on-port-9200/33243/3 "2015-10-29T13:24:43Z")

</div>

I tried changing the network host. First I tried setting it to the EC2's public IP and elasticsearch did not like that. So I opted to user the internal IP and now I am able to access it remotely. However, now I am unable to issue commands locally when I SSH to the server. i.e. localhost:9200 does not work nor using the internal IP of the EC2 instance

In other words the situation is now reversed and I need both ends to work.

UPDATE: I tried setting network.bind\_host to 127.0.0.1 and tried setting the publish\_host to the internal IP and that made the situation go back to the first issue where I am unable to connect remotely. I also tried setting the publish\_host to the public IP and that did not work also.

---

<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:** [October 29, 2015, 2:57pm UTC](https://discuss.elastic.co/t/unable-to-remotely-access-es-server-hosted-on-aws-ec2-on-port-9200/33243/4 "2015-10-29T14:57:29Z")

</div>

So when you set `network.host: _ec2_` what can you see in logs when you start your instance?

It should give you the IP address which elasticsearch is bound to. Can't you use then this IP to connect locally?

---

<div class="post-metadata">

**Author:** ![Zaid\_Amir](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zaid_amir/32/54679_2.png) [@Zaid\_Amir](https://discuss.elastic.co/u/Zaid_Amir)\
**Post date:** [October 29, 2015, 4:43pm UTC](https://discuss.elastic.co/t/unable-to-remotely-access-es-server-hosted-on-aws-ec2-on-port-9200/33243/5 "2015-10-29T16:43:21Z")

</div>

Yes, setting the host as _ec2_ works. it uses the private IP. However, if I set the private IP explicitly it does not.

Thanks, will look into this a bit more

---

<div class="post-metadata">

**Author:** ![mainec](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mainec/32/5557_2.png) [@mainec](https://discuss.elastic.co/u/mainec)\
**Post date:** [October 30, 2015, 8:02am UTC](https://discuss.elastic.co/t/unable-to-remotely-access-es-server-hosted-on-aws-ec2-on-port-9200/33243/6 "2015-10-30T08:02:44Z")

</div>

> [@Zaid\_Amir](#):
>
> Yes, setting the host as ec2 works. it uses the private IP. However, if I set the private IP explicitly it does not.
> 
> Thanks, will look into this a bit more

Could you figure out what went wrong?

Isabel

---

<div class="post-metadata">

**Author:** ![Zaid\_Amir](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zaid_amir/32/54679_2.png) [@Zaid\_Amir](https://discuss.elastic.co/u/Zaid_Amir)\
**Post date:** [October 30, 2015, 8:22am UTC](https://discuss.elastic.co/t/unable-to-remotely-access-es-server-hosted-on-aws-ec2-on-port-9200/33243/7 "2015-10-30T08:22:28Z")

</div>

Not sure what is going on here to be honest. If I set `network.host: _ec2_` it works like a charm but when I set the bind and publish host separately to the local and private IPs respectively, it does not work.

---

<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:** [July 5, 2017, 11:41pm UTC](https://discuss.elastic.co/t/unable-to-remotely-access-es-server-hosted-on-aws-ec2-on-port-9200/33243/8 "2017-07-05T23:41:45Z")

</div>


