# Deploying on EC2: cannot connect remotely to port 9300

**URL:** <https://discuss.elastic.co/t/deploying-on-ec2-cannot-connect-remotely-to-port-9300/34899>\
**Category:** Elasticsearch\
**Created:** [November 18, 2015, 8:44am UTC](https://discuss.elastic.co/t/deploying-on-ec2-cannot-connect-remotely-to-port-9300/34899 "2015-11-18T08:44:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alexey\_Danilov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alexey_danilov/32/5995_2.png) [@Alexey\_Danilov](https://discuss.elastic.co/u/Alexey_Danilov)\
**Post date:** [November 18, 2015, 8:44am UTC](https://discuss.elastic.co/t/deploying-on-ec2-cannot-connect-remotely-to-port-9300/34899/1 "2015-11-18T08:44:36Z")

</div>

Hi. Not sure if this is the right forum to ask, but I'll give it a try.

I have installed ES on Amazon's EC2 instance. Set security group to allow all protocols and all ports - both inbound and outbound (for now, just to make sure this is not causing any problems) and disabled iptables on ec2 instance. I have also assigned an elastic IP (sort of static public IP address) to my instance and installed "cloud-aws" plugin.

/etc/elasticsearch/elasticsearch.yml has the following:

> name: "my-node-1"  
> cluster.name: "my-cluster"  
> cloud.aws.access\_key: "{aws\_key}"  
> cloud.aws.secret\_key: "{aws\_secret}"  
> cloud.aws.region: "eu-west-1"  
> discovery.type: "ec2"  
> discovery.ec2.host\_type: "public\_ip"  
> discovery.ec2.ping\_timeout: "30s"  
> http.cors.enabled: true  
> http.cors.allow-origin: "\*"  
> http.host: "0"  
> network.publish\_host: "{elastic\_ip}"  
> transport.tcp.port: 9300  
> http.port: 9200

I can connect to my ES via HTTP to verify it is working:

both on instance:

> curl -XGET localhost:9200  
> curl -XGET {elastic\_ip}:9200

and remotely:

> curl -XGET {elastic\_ip}:9200

Then I tried to connect to it via Java transport client and stumbled upon "NoNodeAvailableException[None of the configured nodes are available:]". AFAIK this client connects via 9300 port over TCP, so first I tried to verify that connection can be established.

Well, telnet to port 9300 on ec2 instance also failed:

> telnet {elastic\_ip} 9300  
> Trying {elastic\_ip}...  
> telnet: connect to address {elastic\_ip}: Connection refused  
> telnet: Unable to connect to remote host

At the same time, telnet to port 9200 worked fine.

After that I have logged in to instance itself and used telnet there:

> telnet localhost 9200 - works fine  
> telnet {elastic\_ip} 9200 - works fine  
> telnet localhost 9300 - **works fine** (!!!)  
> telnet {elastic\_ip} 9300 - **does not work (but it should)**

output of netstat -tulpn:

> tcp 0 0 :::9200 :::\* LISTEN 27049/java  
> tcp 0 0 ::1:9300 :::\* LISTEN 27049/java  
> tcp 0 0 ::ffff:127.0.0.1:9300 :::\* LISTEN 27049/java

Any advice how to make ES accessible over 9300 port will be very welcome.

---

<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:** [November 18, 2015, 9:17am UTC](https://discuss.elastic.co/t/deploying-on-ec2-cannot-connect-remotely-to-port-9300/34899/2 "2015-11-18T09:17:41Z")

</div>

Can you try `network.host: "{elastic_ip}"` instead of `network.publish_host: "{elastic_ip}"`?

Note that you can also use `_ec2_` or `_ec2:XXX_` if you are using cloud aws plugin. See [https://www.elastic.co/guide/en/elasticsearch/plugins/current/cloud-aws-discovery.html#cloud-aws-discovery-network-host](https://www.elastic.co/guide/en/elasticsearch/plugins/current/cloud-aws-discovery.html#cloud-aws-discovery-network-host)

---

<div class="post-metadata">

**Author:** ![Alexey\_Danilov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alexey_danilov/32/5995_2.png) [@Alexey\_Danilov](https://discuss.elastic.co/u/Alexey_Danilov)\
**Post date:** [November 18, 2015, 1:01pm UTC](https://discuss.elastic.co/t/deploying-on-ec2-cannot-connect-remotely-to-port-9300/34899/3 "2015-11-18T13:01:46Z")

</div>

Thanks for the suggestion - this was really the problem.

---

<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:37pm UTC](https://discuss.elastic.co/t/deploying-on-ec2-cannot-connect-remotely-to-port-9300/34899/4 "2017-07-05T23:37:39Z")

</div>


