# Java client --\> EC2 --\> ES

**URL:** <https://discuss.elastic.co/t/java-client-ec2-es/5911>\
**Category:** Elasticsearch\
**Created:** [November 18, 2011, 11:22am UTC](https://discuss.elastic.co/t/java-client-ec2-es/5911 "2011-11-18T11:22:35Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![achaayan](https://avatars.discourse-cdn.com/v4/letter/a/dbc845/32.png) [@achaayan](https://discuss.elastic.co/u/achaayan)\
**Post date:** [November 18, 2011, 11:22am UTC](https://discuss.elastic.co/t/java-client-ec2-es/5911/1 "2011-11-18T11:22:35Z")

</div>

Hi,  
I have set up ES server in AWS, and it seems to be working fine. I am  
trying to connect programmatically to this server from my java client, by  
creating a node (java application is running outside the cloud). However, I  
am getting binding error : [https://gist.github.com/1376202](https://gist.github.com/1376202)

It this possible? Please let me know if I am doing something wrong.

My Java node object is created with following attributes:

cluster.name :   
network.host : (In server, I have  
configured this name with private IP of server)  
discovery.type : ec2  
cloud.account :   
cloud.key:

---

<div class="post-metadata">

**Author:** ![avasilenko](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/avasilenko/32/2901_2.png) [@avasilenko](https://discuss.elastic.co/u/avasilenko)\
**Post date:** [November 18, 2011, 11:39am UTC](https://discuss.elastic.co/t/java-client-ec2-es/5911/2 "2011-11-18T11:39:53Z")

</div>

Hello Achaayan,

Remove :9300 part from network.host

Regards,  
Alexandr Vasilenko

2011/11/18 achaayan [felixmd@gmail.com](mailto:felixmd@gmail.com)

> Hi,  
> I have set up ES server in AWS, and it seems to be working fine. I am  
> trying to connect programmatically to this server from my java client, by  
> creating a node (java application is running outside the cloud). However, I  
> am getting binding error : [https://gist.github.com/1376202](https://gist.github.com/1376202)
> 
> It this possible? Please let me know if I am doing something wrong.
> 
> My Java node object is created with following attributes:
> 
> cluster.name :   
> network.host : (In server, I have  
> configured this name with private IP of server)  
> discovery.type : ec2  
> cloud.account :   
> cloud.key:

---

<div class="post-metadata">

**Author:** ![achaayan](https://avatars.discourse-cdn.com/v4/letter/a/dbc845/32.png) [@achaayan](https://discuss.elastic.co/u/achaayan)\
**Post date:** [November 18, 2011, 12:27pm UTC](https://discuss.elastic.co/t/java-client-ec2-es/5911/3 "2011-11-18T12:27:28Z")

</div>

Thanks, Alex. I have tried this, but I get the following error: :  
Invocation of init method failed; nested exception is  
org.elasticsearch.transport.BindTransportException: Failed to bind to  
[9300-9400]

I have opened all necessary ports in EC2.

---

<div class="post-metadata">

**Author:** ![avasilenko](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/avasilenko/32/2901_2.png) [@avasilenko](https://discuss.elastic.co/u/avasilenko)\
**Post date:** [November 18, 2011, 12:30pm UTC](https://discuss.elastic.co/t/java-client-ec2-es/5911/4 "2011-11-18T12:30:08Z")

</div>

Probably something is already bound to these ports. Check something like  
lsof -i

Alexandr Vasilenko  
2011/11/18 achaayan [felixmd@gmail.com](mailto:felixmd@gmail.com)

> Thanks, Alex. I have tried this, but I get the following error: :  
> Invocation of init method failed; nested exception is  
> org.elasticsearch.transport.BindTransportException: Failed to bind to  
> [9300-9400]
> 
> I have opened all necessary ports in EC2.

---

<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:** [November 20, 2011, 8:27am UTC](https://discuss.elastic.co/t/java-client-ec2-es/5911/5 "2011-11-20T08:27:37Z")

</div>

If you connect to your cluster on AWS from outside AWS, use transport  
client, with sniff disabled (its the default).

On Fri, Nov 18, 2011 at 2:27 PM, achaayan [felixmd@gmail.com](mailto:felixmd@gmail.com) wrote:

> Thanks, Alex. I have tried this, but I get the following error: :  
> Invocation of init method failed; nested exception is  
> org.elasticsearch.transport.BindTransportException: Failed to bind to  
> [9300-9400]
> 
> I have opened all necessary ports in EC2.

---

<div class="post-metadata">

**Author:** ![achaayan](https://avatars.discourse-cdn.com/v4/letter/a/dbc845/32.png) [@achaayan](https://discuss.elastic.co/u/achaayan)\
**Post date:** [November 21, 2011, 5:39pm UTC](https://discuss.elastic.co/t/java-client-ec2-es/5911/6 "2011-11-21T17:39:24Z")

</div>

Thanks.  
I have tried this, but I get an exception:

org.elasticsearch.transport.RemoteTransportException: Failed to  
deserialize response of type  
[org.elasticsearch.action.admin.cluster.node.info.NodesInfoResponse]  
Caused by:  
org.elasticsearch.transport.TransportSerializationException: Failed to  
deserialize response of type  
[org.elasticsearch.action.admin.cluster.node.info.NodesInfoResponse]  
at  
org.elasticsearch.transport.netty.MessageChannelHandler.handleResponse(MessageChannelHandler.java:  
126)  
at  
org.elasticsearch.transport.netty.MessageChannelHandler.messageReceived(MessageChannelHandler.java:  
103)  
at  
org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:  
80)

It would be great if you could provide me some directions.

On Nov 20, 1:27 pm, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:

> If you connect to your cluster on AWS from outside AWS, use transport  
> client, with sniff disabled (its the default).
> 
> On Fri, Nov 18, 2011 at 2:27 PM, achaayan [feli...@gmail.com](mailto:feli...@gmail.com) wrote:
> 
> > Thanks, Alex. I have tried this, but I get the following error: :  
> > Invocation of init method failed; nested exception is  
> > org.elasticsearch.transport.BindTransportException: Failed to bind to  
> > [9300-9400]
> 
> > I have opened all necessary ports in EC2.

---

<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:** [November 22, 2011, 12:39pm UTC](https://discuss.elastic.co/t/java-client-ec2-es/5911/7 "2011-11-22T12:39:53Z")

</div>

Answered on another thread you opened, I think you use different versions  
of elasticsearch.

On Mon, Nov 21, 2011 at 7:39 PM, achaayan [felixmd@gmail.com](mailto:felixmd@gmail.com) wrote:

> Thanks.  
> I have tried this, but I get an exception:
> 
> org.elasticsearch.transport.RemoteTransportException: Failed to  
> deserialize response of type  
> [org.elasticsearch.action.admin.cluster.node.info.NodesInfoResponse]  
> Caused by:  
> org.elasticsearch.transport.TransportSerializationException: Failed to  
> deserialize response of type  
> [org.elasticsearch.action.admin.cluster.node.info.NodesInfoResponse]  
> at
> 
> org.elasticsearch.transport.netty.MessageChannelHandler.handleResponse(MessageChannelHandler.java:  
> 126)  
> at
> 
> org.elasticsearch.transport.netty.MessageChannelHandler.messageReceived(MessageChannelHandler.java:  
> 103)  
> at
> 
> org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:  
> 80)
> 
> It would be great if you could provide me some directions.
> 
> On Nov 20, 1:27 pm, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:
> 
> > If you connect to your cluster on AWS from outside AWS, use transport  
> > client, with sniff disabled (its the default).
> > 
> > On Fri, Nov 18, 2011 at 2:27 PM, achaayan [feli...@gmail.com](mailto:feli...@gmail.com) wrote:
> > 
> > > Thanks, Alex. I have tried this, but I get the following error: :  
> > > Invocation of init method failed; nested exception is  
> > > org.elasticsearch.transport.BindTransportException: Failed to bind to  
> > > [9300-9400]
> > 
> > > I have opened all necessary ports in EC2.

---

<div class="post-metadata">

**Author:** ![achaayan](https://avatars.discourse-cdn.com/v4/letter/a/dbc845/32.png) [@achaayan](https://discuss.elastic.co/u/achaayan)\
**Post date:** [November 23, 2011, 1:27am UTC](https://discuss.elastic.co/t/java-client-ec2-es/5911/8 "2011-11-23T01:27:44Z")

</div>

Thanks, Shay - changing client jar version fixed this problem. Both  
threads described same issues, but on different scenarios.

On Nov 22, 5:39 pm, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:

> Answered on another thread you opened, I think you use different versions  
> of elasticsearch.
> 
> On Mon, Nov 21, 2011 at 7:39 PM, achaayan [feli...@gmail.com](mailto:feli...@gmail.com) wrote:
> 
> > Thanks.  
> > I have tried this, but I get an exception:
> 
> > org.elasticsearch.transport.RemoteTransportException: Failed to  
> > deserialize response of type  
> > [org.elasticsearch.action.admin.cluster.node.info.NodesInfoResponse]  
> > Caused by:  
> > org.elasticsearch.transport.TransportSerializationException: Failed to  
> > deserialize response of type  
> > [org.elasticsearch.action.admin.cluster.node.info.NodesInfoResponse]  
> > at
> 
> > org.elasticsearch.transport.netty.MessageChannelHandler.handleResponse(Mess ageChannelHandler.java:  
> > 126)  
> > at
> 
> > org.elasticsearch.transport.netty.MessageChannelHandler.messageReceived(Mes sageChannelHandler.java:  
> > 103)  
> > at
> 
> > org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleU pstream(SimpleChannelUpstreamHandler.java:  
> > 80)
> 
> > It would be great if you could provide me some directions.
> 
> > On Nov 20, 1:27 pm, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:
> > 
> > > If you connect to your cluster on AWS from outside AWS, use transport  
> > > client, with sniff disabled (its the default).
> 
> > > On Fri, Nov 18, 2011 at 2:27 PM, achaayan [feli...@gmail.com](mailto:feli...@gmail.com) wrote:
> > > 
> > > > Thanks, Alex. I have tried this, but I get the following error: :  
> > > > Invocation of init method failed; nested exception is  
> > > > org.elasticsearch.transport.BindTransportException: Failed to bind to  
> > > > [9300-9400]
> 
> > > > I have opened all necessary ports in EC2.

---

<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:47am UTC](https://discuss.elastic.co/t/java-client-ec2-es/5911/9 "2017-07-06T03:47:45Z")

</div>


