# Ec2 & public ip

**URL:** <https://discuss.elastic.co/t/ec2-public-ip/5452>\
**Category:** Elasticsearch\
**Created:** [September 26, 2011, 3:43pm UTC](https://discuss.elastic.co/t/ec2-public-ip/5452 "2011-09-26T15:43:04Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Karussell1](https://avatars.discourse-cdn.com/v4/letter/k/50afbb/32.png) [@Karussell1](https://discuss.elastic.co/u/Karussell1)\
**Post date:** [September 26, 2011, 3:43pm UTC](https://discuss.elastic.co/t/ec2-public-ip/5452/1 "2011-09-26T15:43:04Z")

</div>

Hi,

I'm currently trying out Elasticsearch on an ec2 machine and  
connecting to it via JSON or elasticsearch-head works using the public  
IP. I simply want to make it insecure and open Elasticsearch to  
everyone.

But using the transport client does not work - it waits some seconds  
and then reports that there is no node available.  
How can I tell elasticsearch to use the public IP adress as  
elasticsearch says:  
[2011-09-26 15:32:56,469][INFO][transport] [Starhawk]  
bound\_address {inet[/0:0:0:0:0:0:0:0:9300]}, publish\_address {inet[/  
THE\_PRIVATE\_IP:9300]}

I tried this in the config:

network.publish\_host._ec2: publicIpv4_

but it does not work. Also I do not understand why the ES-HEAD works  
over 9200 and the transport client not, although both are binding to  
the private adress (both ports + http are open). Can someone explain  
this to a network noob 🙂 ?

Regards,  
Peter.

---

<div class="post-metadata">

**Author:** ![Paul\_Loy](https://avatars.discourse-cdn.com/v4/letter/p/ad7895/32.png) [@Paul\_Loy](https://discuss.elastic.co/u/Paul_Loy)\
**Post date:** [September 26, 2011, 3:51pm UTC](https://discuss.elastic.co/t/ec2-public-ip/5452/2 "2011-09-26T15:51:57Z")

</div>

On Mon, Sep 26, 2011 at 4:43 PM, Karussell [tableyourtime@googlemail.com](mailto:tableyourtime@googlemail.com)wrote:

> Hi,
> 
> I'm currently trying out Elasticsearch on an ec2 machine and  
> connecting to it via JSON or elasticsearch-head works using the public  
> IP. I simply want to make it insecure and open Elasticsearch to  
> everyone.
> 
> But using the transport client does not work - it waits some seconds  
> and then reports that there is no node available.  
> How can I tell elasticsearch to use the public IP adress as  
> elasticsearch says:  
> [2011-09-26 15:32:56,469][INFO][transport] [Starhawk]  
> bound\_address {inet[/0:0:0:0:0:0:0:0:9300]}, publish\_address {inet[/  
> THE\_PRIVATE\_IP:9300]}
> 
> I tried this in the config:
> 
> network.publish\_host._ec2: publicIpv4_
> 
> but it does not work. Also I do not understand why the ES-HEAD works  
> over 9200 and the transport client not, although both are binding to  
> the private adress (both ports + http are open). Can someone explain  
> this to a network noob 🙂 ?
> 
> Regards,  
> Peter.

I think the config is slightly wrong, try this:

## network.publish\_host: _ec2:publicIpv4_

* * *

Paul Loy  
[paul@keteracel.com](mailto:paul@keteracel.com)  
[http://uk.linkedin.com/in/paulloy](http://uk.linkedin.com/in/paulloy)

---

<div class="post-metadata">

**Author:** ![Karussell1](https://avatars.discourse-cdn.com/v4/letter/k/50afbb/32.png) [@Karussell1](https://discuss.elastic.co/u/Karussell1)\
**Post date:** [September 26, 2011, 5:03pm UTC](https://discuss.elastic.co/t/ec2-public-ip/5452/3 "2011-09-26T17:03:11Z")

</div>

Cool, thanks Paul! now ES reports the public ip:

transport] [Razor Fist] bound\_address {inet[/0:0:0:0:0:0:0:0:9300]},  
publish\_address {inet[/PUBLIC\_IP:9300]}

but the transport client connection is not working.Not sure if this is  
related but ES still reports private IP adresses at several points in  
the logs:

> <https://gist.github.com/karussell/1242740>

---

<div class="post-metadata">

**Author:** ![Karussell1](https://avatars.discourse-cdn.com/v4/letter/k/50afbb/32.png) [@Karussell1](https://discuss.elastic.co/u/Karussell1)\
**Post date:** [September 26, 2011, 5:08pm UTC](https://discuss.elastic.co/t/ec2-public-ip/5452/4 "2011-09-26T17:08:22Z")

</div>

Do i need to configure the TransportClient (which is not on an ec2  
machine) in a different way than the data node?

On 26 Sep., 19:03, Karussell [tableyourt...@googlemail.com](mailto:tableyourt...@googlemail.com) wrote:

> Cool, thanks Paul! now ES reports the public ip:
> 
> transport] [Razor Fist] bound\_address {inet[/0:0:0:0:0:0:0:0:9300]},  
> publish\_address {inet[/PUBLIC\_IP:9300]}
> 
> but the transport client connection is not working.Not sure if this is  
> related but ES still reports private IP adresses at several points in  
> the logs:
> 
> [elasticsearch on ec2 ip problems · GitHub](https://gist.github.com/1242740)

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [September 26, 2011, 5:27pm UTC](https://discuss.elastic.co/t/ec2-public-ip/5452/5 "2011-09-26T17:27:34Z")

</div>

The log that you see means that when a nodes starts up, and tries to check  
for the list of nodes to connect to, it goes to the amazon API and fetches  
the list of machines. By default, it will use the private IP to try and  
connect to the node. You don't really need to change, but you can, by  
setting discovery.ec2.host\_type to public\_ip.

The instance started binds to "any host" address. The fact that you can  
connect to it using elasticsearch-head means that it works host wise. Are  
you sure you opened the 9300 port in the security group or other firewall  
settings?

On Mon, Sep 26, 2011 at 8:08 PM, Karussell [tableyourtime@googlemail.com](mailto:tableyourtime@googlemail.com)wrote:

> Do i need to configure the TransportClient (which is not on an ec2  
> machine) in a different way than the data node?
> 
> On 26 Sep., 19:03, Karussell [tableyourt...@googlemail.com](mailto:tableyourt...@googlemail.com) wrote:
> 
> > Cool, thanks Paul! now ES reports the public ip:
> > 
> > transport] [Razor Fist] bound\_address {inet[/0:0:0:0:0:0:0:0:9300]},  
> > publish\_address {inet[/PUBLIC\_IP:9300]}
> > 
> > but the transport client connection is not working.Not sure if this is  
> > related but ES still reports private IP adresses at several points in  
> > the logs:
> > 
> > [elasticsearch on ec2 ip problems · GitHub](https://gist.github.com/1242740)

---

<div class="post-metadata">

**Author:** ![Karussell1](https://avatars.discourse-cdn.com/v4/letter/k/50afbb/32.png) [@Karussell1](https://discuss.elastic.co/u/Karussell1)\
**Post date:** [September 27, 2011, 4:27pm UTC](https://discuss.elastic.co/t/ec2-public-ip/5452/6 "2011-09-27T16:27:22Z")

</div>

Hello Shay,

thanks for your answer!

I have re-enabled the port and but it is the same problem.  
What I cannot understand is why I cannot even make it working when  
using a ssh port forwarding:

ssh -l user -L 9999:localhost:9300 PUBLIC\_IP

then using 9999 as port in the transport client (which btw does not  
use the aws cloud settings)

I'll investigate it further ... 🙂

Regards,  
Peter.

On 26 Sep., 19:27, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:

> The log that you see means that when a nodes starts up, and tries to check  
> for the list of nodes to connect to, it goes to the amazon API and fetches  
> the list of machines. By default, it will use the private IP to try and  
> connect to the node. You don't really need to change, but you can, by  
> setting discovery.ec2.host\_type to public\_ip.
> 
> The instance started binds to "any host" address. The fact that you can  
> connect to it using elasticsearch-head means that it works host wise. Are  
> you sure you opened the 9300 port in the security group or other firewall  
> settings?
> 
> On Mon, Sep 26, 2011 at 8:08 PM, Karussell [tableyourt...@googlemail.com](mailto:tableyourt...@googlemail.com)wrote:
> 
> > Do i need to configure the TransportClient (which is not on an ec2  
> > machine) in a different way than the data node?
> 
> > On 26 Sep., 19:03, Karussell [tableyourt...@googlemail.com](mailto:tableyourt...@googlemail.com) wrote:
> > 
> > > Cool, thanks Paul! now ES reports the public ip:
> 
> > > transport] [Razor Fist] bound\_address {inet[/0:0:0:0:0:0:0:0:9300]},  
> > > publish\_address {inet[/PUBLIC\_IP:9300]}
> 
> > > but the transport client connection is not working.Not sure if this is  
> > > related but ES still reports private IP adresses at several points in  
> > > the logs:
> 
> > > [elasticsearch on ec2 ip problems · GitHub](https://gist.github.com/1242740)

---

<div class="post-metadata">

**Author:** ![Karussell1](https://avatars.discourse-cdn.com/v4/letter/k/50afbb/32.png) [@Karussell1](https://discuss.elastic.co/u/Karussell1)\
**Post date:** [September 29, 2011, 12:57pm UTC](https://discuss.elastic.co/t/ec2-public-ip/5452/7 "2011-09-29T12:57:14Z")

</div>

After creating a new ec2 machine it now works ...

On 27 Sep., 18:27, Karussell [tableyourt...@googlemail.com](mailto:tableyourt...@googlemail.com) wrote:

> Hello Shay,
> 
> thanks for your answer!
> 
> I have re-enabled the port and but it is the same problem.  
> What I cannot understand is why I cannot even make it working when  
> using a ssh port forwarding:
> 
> ssh -l user -L 9999:localhost:9300 PUBLIC\_IP
> 
> then using 9999 as port in the transport client (which btw does not  
> use the aws cloud settings)
> 
> I'll investigate it further ... 🙂
> 
> Regards,  
> Peter.
> 
> On 26 Sep., 19:27, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:
> 
> > The log that you see means that when a nodes starts up, and tries to check  
> > for the list of nodes to connect to, it goes to the amazon API and fetches  
> > the list of machines. By default, it will use the private IP to try and  
> > connect to the node. You don't really need to change, but you can, by  
> > setting discovery.ec2.host\_type to public\_ip.
> 
> > The instance started binds to "any host" address. The fact that you can  
> > connect to it using elasticsearch-head means that it works host wise. Are  
> > you sure you opened the 9300 port in the security group or other firewall  
> > settings?
> 
> > On Mon, Sep 26, 2011 at 8:08 PM, Karussell [tableyourt...@googlemail.com](mailto:tableyourt...@googlemail.com)wrote:
> 
> > > Do i need to configure the TransportClient (which is not on anec2  
> > > machine) in a different way than the data node?
> 
> > > On 26 Sep., 19:03, Karussell [tableyourt...@googlemail.com](mailto:tableyourt...@googlemail.com) wrote:
> > > 
> > > > Cool, thanks Paul! now ES reports the public ip:
> 
> > > > transport] [Razor Fist] bound\_address {inet[/0:0:0:0:0:0:0:0:9300]},  
> > > > publish\_address {inet[/PUBLIC\_IP:9300]}
> 
> > > > but the transport client connection is not working.Not sure if this is  
> > > > related but ES still reports private IP adresses at several points in  
> > > > the logs:
> 
> > > > [elasticsearch on ec2 ip problems · GitHub](https://gist.github.com/1242740)

---

<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 6, 2017, 3:53am UTC](https://discuss.elastic.co/t/ec2-public-ip/5452/8 "2017-07-06T03:53:22Z")

</div>


