# Unable to access EC2 ElasticSearch7.5.2 Server using EC2 Public IP on local machine

**URL:** <https://discuss.elastic.co/t/unable-to-access-ec2-elasticsearch7-5-2-server-using-ec2-public-ip-on-local-machine/221854>\
**Category:** Elasticsearch\
**Created:** [March 3, 2020, 10:38am UTC](https://discuss.elastic.co/t/unable-to-access-ec2-elasticsearch7-5-2-server-using-ec2-public-ip-on-local-machine/221854 "2020-03-03T10:38:01Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![shaheryar.malik](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shaheryar.malik/32/45343_2.png) [@shaheryar.malik](https://discuss.elastic.co/u/shaheryar.malik)\
**Post date:** [March 3, 2020, 10:38am UTC](https://discuss.elastic.co/t/unable-to-access-ec2-elasticsearch7-5-2-server-using-ec2-public-ip-on-local-machine/221854/1 "2020-03-03T10:38:02Z")

</div>

I am using Elasticsearch7.5.2 on EC2 instance and I have modified config/elasticsearch.yml as:

```
network.host: 0.0.0.0
node.master: true
node.data: true
transport.host: localhost
transport.tcp.port: 9300

```

I can access it inside EC2 by using localhost and EC2 private IP. See attached images: ![1](https://us1.discourse-cdn.com/elastic/original/3X/d/8/d85c4ab0669d22e71204a5ccd802761b2f18a930.png) ![2](https://us1.discourse-cdn.com/elastic/original/3X/2/3/2357477746b304bb0bc2fa5f08a70a586ed8a97e.png)  
But when I use public IP of EC2 to access it from my local machine. It doesn't give any response. See attached image:

 ![3](https://us1.discourse-cdn.com/elastic/original/3X/8/8/881cb8615949355874548902d729df372b242ba6.png)

Anyone who can help?

---

<div class="post-metadata">

**Author:** ![HenningAndersen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/henningandersen/32/48188_2.png) [@HenningAndersen](https://discuss.elastic.co/u/HenningAndersen)\
**Post date:** [March 3, 2020, 11:22am UTC](https://discuss.elastic.co/t/unable-to-access-ec2-elasticsearch7-5-2-server-using-ec2-public-ip-on-local-machine/221854/2 "2020-03-03T11:22:09Z")

</div>

Hi @shaheryar.malik,

can you check that the Elasticsearch java process did bind its port 9200 to the specified ip?

Also, this could be a firewall problem between your local machine and the setup. Can you do

```auto
curl 13.232.42.209:9200

```

from the local machine and/or from a machine in same VPC or different VPC?

---

<div class="post-metadata">

**Author:** ![rameshkr1994](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rameshkr1994/32/59029_2.png) [@rameshkr1994](https://discuss.elastic.co/u/rameshkr1994)\
**Post date:** [March 3, 2020, 1:03pm UTC](https://discuss.elastic.co/t/unable-to-access-ec2-elasticsearch7-5-2-server-using-ec2-public-ip-on-local-machine/221854/3 "2020-03-03T13:03:38Z")

</div>

Hi @shaheryar.malik.  
please check as below , it may be helpful to you!  
We can’t access this elastic search from remote machine as below image :

For localhost or private IP-  
 ![image](https://us1.discourse-cdn.com/elastic/original/3X/e/a/ea41b6bfb205010a5b84b21688e3894c918c8222.png)  
For VM Public IP 👎  
 ![image](https://us1.discourse-cdn.com/elastic/original/3X/4/6/46adc19bfbd1529fef21eb50e24de3128b853bee.png)

we need to make as IP based elastic search for access through the network

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/1/e/1ecc479b34455cc4197cf4ba2f17f57420422e50.png)  
Edit hosts file as below :  
$nano /etc/hosts  
 ![image](https://us1.discourse-cdn.com/elastic/original/3X/a/0/a0ecd11188701681694ffe57b14e597ce48cd01a.png)

Just map IGIVM with VM Public IP address as below :

Save this file .  
 ![image](https://us1.discourse-cdn.com/elastic/original/3X/5/5/5502f4e4aae04d35d26e99382d7caf04f9aa0063.png)  
Stop elastic search and restart It as below image:-  
Command :-

$systemctl stop elasticsearch.searvice

$ systemctl start elasticsearch.searvice

$ systemctl status elasticsearch.searvice

NOW WE CAN SEE ELASTIC SEARCH IS UP AND RUNNING.  
 ![image](https://us1.discourse-cdn.com/elastic/original/3X/9/1/91229332e81e1d21edbc9105418e66781c7eb899.png)  
NOW we can access this elastic search from remote machine  
 ![image](https://us1.discourse-cdn.com/elastic/original/3X/9/d/9d9cc395c8dd22422b9d602d9d2153729507628c.png)

Thanks  
HadoopHelp

---

<div class="post-metadata">

**Author:** ![shaheryar.malik](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shaheryar.malik/32/45343_2.png) [@shaheryar.malik](https://discuss.elastic.co/u/shaheryar.malik)\
**Post date:** [March 3, 2020, 1:05pm UTC](https://discuss.elastic.co/t/unable-to-access-ec2-elasticsearch7-5-2-server-using-ec2-public-ip-on-local-machine/221854/4 "2020-03-03T13:05:48Z")

</div>

I am quite new. Please let me know specific file that I need to verify. On EC2 security group, for testing, I have allowed "All Traffic".

---

<div class="post-metadata">

**Author:** ![shaheryar.malik](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shaheryar.malik/32/45343_2.png) [@shaheryar.malik](https://discuss.elastic.co/u/shaheryar.malik)\
**Post date:** [March 3, 2020, 1:08pm UTC](https://discuss.elastic.co/t/unable-to-access-ec2-elasticsearch7-5-2-server-using-ec2-public-ip-on-local-machine/221854/5 "2020-03-03T13:08:27Z")

</div>

How can I access /etc/hosts since on EC2 Windows Instance, I have only these folders: ![4](https://us1.discourse-cdn.com/elastic/original/3X/4/1/41ca331eded0ef95176212c7bdf306384acaf443.png)

---

<div class="post-metadata">

**Author:** ![rameshkr1994](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rameshkr1994/32/59029_2.png) [@rameshkr1994](https://discuss.elastic.co/u/rameshkr1994)\
**Post date:** [March 3, 2020, 1:11pm UTC](https://discuss.elastic.co/t/unable-to-access-ec2-elasticsearch7-5-2-server-using-ec2-public-ip-on-local-machine/221854/6 "2020-03-03T13:11:27Z")

</div>

Hi @shaheryar.malik.

This is only related with elastic search files .

i think your elastic has been installed on windows ?

as i shared that is related with Azure VM.but in your case also config will be same.

Thanks  
HadoopHelp

---

<div class="post-metadata">

**Author:** ![rameshkr1994](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rameshkr1994/32/59029_2.png) [@rameshkr1994](https://discuss.elastic.co/u/rameshkr1994)\
**Post date:** [March 3, 2020, 1:33pm UTC](https://discuss.elastic.co/t/unable-to-access-ec2-elasticsearch7-5-2-server-using-ec2-public-ip-on-local-machine/221854/7 "2020-03-03T13:33:12Z")

</div>

Ho @shaheryar.malik.

this host file also there with windows machine.

just check - in my case win10

`like below- "C:\ **Windows** \System32\drivers\etc\ **hosts**".`

Thanks  
HadoopHelp

---

<div class="post-metadata">

**Author:** ![shaheryar.malik](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shaheryar.malik/32/45343_2.png) [@shaheryar.malik](https://discuss.elastic.co/u/shaheryar.malik)\
**Post date:** [March 4, 2020, 5:04am UTC](https://discuss.elastic.co/t/unable-to-access-ec2-elasticsearch7-5-2-server-using-ec2-public-ip-on-local-machine/221854/8 "2020-03-04T05:04:44Z")

</div>

Hi, I have applied everything but unable to access ES from EC2 public IP.  
Here are screenshots so you can check:  
/config/elasticsearch.yml  
 ![ES](https://us1.discourse-cdn.com/elastic/original/3X/a/2/a2fd57cb49fc795667932105d56cd53c75567139.png)  
/etc/hosts

 ![Hosts](https://us1.discourse-cdn.com/elastic/original/3X/4/e/4e252b4b06403fff5a75ebf04b7d32bc00ccdfe1.png)  
When I run ES, these are the logs:  
 ![Logs](https://us1.discourse-cdn.com/elastic/original/3X/1/8/18d952d80958e966bef2b6196bb653f2b7a7e11f.png)

Here is major problem, I am trying to access from EC2 public IP which is mapped with IGIVM in hosts file. I am still unable to access ☹

 ![Remote](https://us1.discourse-cdn.com/elastic/original/3X/b/c/bce844a55da5cfa18ab983c15e294dd39db799ad.png)

Let me know if I am missing something!

---

<div class="post-metadata">

**Author:** ![rameshkr1994](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rameshkr1994/32/59029_2.png) [@rameshkr1994](https://discuss.elastic.co/u/rameshkr1994)\
**Post date:** [March 4, 2020, 7:02am UTC](https://discuss.elastic.co/t/unable-to-access-ec2-elasticsearch7-5-2-server-using-ec2-public-ip-on-local-machine/221854/9 "2020-03-04T07:02:35Z")

</div>

Hi @shaheryar.malik.

so now i am sure. your elastic search has been installed in windows machine as i am looking and you want to access the same elastic search over a network as i shared ?

pls confirm me about above?

this is your machine IP-`172.31.33.208:9200`?

i think , this ip`172.31.33.208:9200` you can access?

Thanks  
HadoopHelp

---

<div class="post-metadata">

**Author:** ![shaheryar.malik](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shaheryar.malik/32/45343_2.png) [@shaheryar.malik](https://discuss.elastic.co/u/shaheryar.malik)\
**Post date:** [March 4, 2020, 7:16am UTC](https://discuss.elastic.co/t/unable-to-access-ec2-elasticsearch7-5-2-server-using-ec2-public-ip-on-local-machine/221854/10 "2020-03-04T07:16:56Z")

</div>

172.31.33.208 is private IP of EC2 while 15.206.171.100 is public IP.

---

<div class="post-metadata">

**Author:** ![rameshkr1994](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rameshkr1994/32/59029_2.png) [@rameshkr1994](https://discuss.elastic.co/u/rameshkr1994)\
**Post date:** [March 4, 2020, 7:21am UTC](https://discuss.elastic.co/t/unable-to-access-ec2-elasticsearch7-5-2-server-using-ec2-public-ip-on-local-machine/221854/11 "2020-03-04T07:21:25Z")

</div>

where you installed elatic search ?  
on top of EC2 or local windows ?

---

<div class="post-metadata">

**Author:** ![shaheryar.malik](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shaheryar.malik/32/45343_2.png) [@shaheryar.malik](https://discuss.elastic.co/u/shaheryar.malik)\
**Post date:** [March 4, 2020, 7:25am UTC](https://discuss.elastic.co/t/unable-to-access-ec2-elasticsearch7-5-2-server-using-ec2-public-ip-on-local-machine/221854/12 "2020-03-04T07:25:58Z")

</div>

Yes, ES is in EC2. And I want to access on local windows.

---

<div class="post-metadata">

**Author:** ![rameshkr1994](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rameshkr1994/32/59029_2.png) [@rameshkr1994](https://discuss.elastic.co/u/rameshkr1994)\
**Post date:** [March 4, 2020, 2:33pm UTC](https://discuss.elastic.co/t/unable-to-access-ec2-elasticsearch7-5-2-server-using-ec2-public-ip-on-local-machine/221854/13 "2020-03-04T14:33:57Z")

</div>

Hi @shaheryar.malik.

`> if your elastic is running on EC2 then you need to check same configuration there only(EC2).`

why you are using windows elastic config files here with windows machine.  
in simple , you want to access / query that EC2 elastic from windows machine right?

`Note-you need to check all config file with EC2 only` .

within EC2 - there two IP is there one is Private and another is Public ,  
you need to bind public IP here as i did in my case.

Thanks  
HadoopHelp

---

<div class="post-metadata">

**Author:** ![Sam\_Xiao](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sam_xiao/32/61814_2.png) [@Sam\_Xiao](https://discuss.elastic.co/u/Sam_Xiao)\
**Post date:** [March 5, 2020, 2:33am UTC](https://discuss.elastic.co/t/unable-to-access-ec2-elasticsearch7-5-2-server-using-ec2-public-ip-on-local-machine/221854/14 "2020-03-05T02:33:14Z")

</div>

This is it. I've finished the same on my own.

---

<div class="post-metadata">

**Author:** ![rameshkr1994](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rameshkr1994/32/59029_2.png) [@rameshkr1994](https://discuss.elastic.co/u/rameshkr1994)\
**Post date:** [March 5, 2020, 7:01am UTC](https://discuss.elastic.co/t/unable-to-access-ec2-elasticsearch7-5-2-server-using-ec2-public-ip-on-local-machine/221854/15 "2020-03-05T07:01:50Z")

</div>

Hi @Sam_Xiao.

please help him @shaheryar.malik .

if you had done.

Thanks  
HadoopHelp

---

<div class="post-metadata">

**Author:** ![Sam\_Xiao](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sam_xiao/32/61814_2.png) [@Sam\_Xiao](https://discuss.elastic.co/u/Sam_Xiao)\
**Post date:** [March 5, 2020, 7:14am UTC](https://discuss.elastic.co/t/unable-to-access-ec2-elasticsearch7-5-2-server-using-ec2-public-ip-on-local-machine/221854/16 "2020-03-05T07:14:56Z")

</div>

Well.. you're comment is really clear enough. Good share by the way. Thanks.

---

<div class="post-metadata">

**Author:** ![shaheryar.malik](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shaheryar.malik/32/45343_2.png) [@shaheryar.malik](https://discuss.elastic.co/u/shaheryar.malik)\
**Post date:** [March 5, 2020, 7:49am UTC](https://discuss.elastic.co/t/unable-to-access-ec2-elasticsearch7-5-2-server-using-ec2-public-ip-on-local-machine/221854/17 "2020-03-05T07:49:12Z")

</div>

I bind ec2 public IP in hosts file but that did not work. Please explain what is meant by this "if your elastic is running on EC2 then you need to check same configuration there only(EC2)."  
Just to clear, I have binaries of elasticsearch in EC2 Windows Instance and that has private and public ips. Within EC2 it is accessible via private ip but in my local machine, it is not accessible via public ip which I bind in EC2 hosts file.

---

<div class="post-metadata">

**Author:** ![shaheryar.malik](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shaheryar.malik/32/45343_2.png) [@shaheryar.malik](https://discuss.elastic.co/u/shaheryar.malik)\
**Post date:** [March 5, 2020, 7:50am UTC](https://discuss.elastic.co/t/unable-to-access-ec2-elasticsearch7-5-2-server-using-ec2-public-ip-on-local-machine/221854/18 "2020-03-05T07:50:18Z")

</div>

I am working in windows ec2 instance. If you can share all files that you modified and public/private ips that you bind in ec2, that might help.

---

<div class="post-metadata">

**Author:** ![Sam\_Xiao](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sam_xiao/32/61814_2.png) [@Sam\_Xiao](https://discuss.elastic.co/u/Sam_Xiao)\
**Post date:** [March 6, 2020, 3:51am UTC](https://discuss.elastic.co/t/unable-to-access-ec2-elasticsearch7-5-2-server-using-ec2-public-ip-on-local-machine/221854/20 "2020-03-06T03:51:43Z")

</div>

We adjust the config:

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

you should use private IP or 0.0.0.0

---

<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 3, 2020, 3:51am UTC](https://discuss.elastic.co/t/unable-to-access-ec2-elasticsearch7-5-2-server-using-ec2-public-ip-on-local-machine/221854/21 "2020-04-03T03:51:50Z")

</div>

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