# AWS - Unable to connect to EC2 instance publically

**URL:** <https://discuss.elastic.co/t/aws-unable-to-connect-to-ec2-instance-publically/14565>\
**Category:** Elasticsearch\
**Created:** [November 24, 2013, 1:14pm UTC](https://discuss.elastic.co/t/aws-unable-to-connect-to-ec2-instance-publically/14565 "2013-11-24T13:14:26Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ben\_3](https://avatars.discourse-cdn.com/v4/letter/b/e36b37/32.png) [@Ben\_3](https://discuss.elastic.co/u/Ben_3)\
**Post date:** [November 24, 2013, 1:14pm UTC](https://discuss.elastic.co/t/aws-unable-to-connect-to-ec2-instance-publically/14565/1 "2013-11-24T13:14:26Z")

</div>

I have a single node of ES running on a CentOS EC2 environment.

I wish to connect to the node remotely via the public internet, however am  
unable to access using either the public ip or hostname.

My /config/elasticsearch.yml has the following entrances:

cluster.name: test-cluster  
cloud:  
aws:  
access\_key: \<my\_key\>  
secret\_key: \<my\_secret\>  
discovery:  
type: ec2

I have opened all ports for all traffic (for testing purposes) within the  
EC2 security group.

Running: curl 172.31.42.186:9200 on the machine via SSH results in a  
successful JSON response, however doing the same from a machine external to  
AWS using the external ip or host fails.

On startup, I can see ES binding to the internal address, which I would  
assume would be NAT'd by AWS from the external.

2013-11-24 13:11:51,094][INFO][http] [Azazel] bound\_address  
{inet[/0:0:0:0:0:0:0:0:9200]}, publish\_address {inet[/172.31.42.186:9200]}

Can anyone advise?

Regards, Ben.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Amit\_Soni](https://avatars.discourse-cdn.com/v4/letter/a/c0e974/32.png) [@Amit\_Soni](https://discuss.elastic.co/u/Amit_Soni)\
**Post date:** [November 24, 2013, 5:00pm UTC](https://discuss.elastic.co/t/aws-unable-to-connect-to-ec2-instance-publically/14565/2 "2013-11-24T17:00:21Z")

</div>

did you check the firewall setting?

-Amit.

On Sun, Nov 24, 2013 at 5:14 AM, Ben [benhagan@gmail.com](mailto:benhagan@gmail.com) wrote:

> I have a single node of ES running on a CentOS EC2 environment.
> 
> I wish to connect to the node remotely via the public internet, however am  
> unable to access using either the public ip or hostname.
> 
> My /config/elasticsearch.yml has the following entrances:
> 
> cluster.name: test-cluster  
> cloud:  
> aws:  
> access\_key: \<my\_key\>  
> secret\_key: \<my\_secret\>  
> discovery:  
> type: ec2
> 
> I have opened all ports for all traffic (for testing purposes) within the  
> EC2 security group.
> 
> Running: curl 172.31.42.186:9200 on the machine via SSH results in a  
> successful JSON response, however doing the same from a machine external to  
> AWS using the external ip or host fails.
> 
> On startup, I can see ES binding to the internal address, which I would  
> assume would be NAT'd by AWS from the external.
> 
> 2013-11-24 13:11:51,094][INFO][http] [Azazel] bound\_address  
> {inet[/0:0:0:0:0:0:0:0:9200]}, publish\_address {inet[/172.31.42.186:9200]}
> 
> Can anyone advise?
> 
> Regards, Ben.
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Ben\_3](https://avatars.discourse-cdn.com/v4/letter/b/e36b37/32.png) [@Ben\_3](https://discuss.elastic.co/u/Ben_3)\
**Post date:** [November 24, 2013, 9:03pm UTC](https://discuss.elastic.co/t/aws-unable-to-connect-to-ec2-instance-publically/14565/3 "2013-11-24T21:03:15Z")

</div>

Yes:

I have opened all ports for all traffic (for testing purposes) within the

> EC2 security group.

Ben.

On Sunday, November 24, 2013 5:00:21 PM UTC, amit.soni wrote:

> did you check the firewall setting?
> 
> -Amit.
> 
> On Sun, Nov 24, 2013 at 5:14 AM, Ben \<[benh...@gmail.com](mailto:benh...@gmail.com) \<javascript:\>\>wrote:
> 
> > I have a single node of ES running on a CentOS EC2 environment.
> > 
> > I wish to connect to the node remotely via the public internet, however  
> > am unable to access using either the public ip or hostname.
> > 
> > My /config/elasticsearch.yml has the following entrances:
> > 
> > cluster.name[http://www.google.com/url?q=http%3A%2F%2Fcluster.name&sa=D&sntz=1&usg=AFQjCNGbdss-\_rGgAY2He8KM6ZUy2TdG8g](http://www.google.com/url?q=http%3A%2F%2Fcluster.name&sa=D&sntz=1&usg=AFQjCNGbdss-_rGgAY2He8KM6ZUy2TdG8g):  
> > test-cluster  
> > cloud:  
> > aws:  
> > access\_key: \<my\_key\>  
> > secret\_key: \<my\_secret\>  
> > discovery:  
> > type: ec2
> > 
> > I have opened all ports for all traffic (for testing purposes) within the  
> > EC2 security group.
> > 
> > Running: curl 172.31.42.186:9200[http://www.google.com/url?q=http%3A%2F%2F172.31.42.186%3A9200&sa=D&sntz=1&usg=AFQjCNGeOdnBtGglutBnnTwVGlS7E\_xNMA](http://www.google.com/url?q=http%3A%2F%2F172.31.42.186%3A9200&sa=D&sntz=1&usg=AFQjCNGeOdnBtGglutBnnTwVGlS7E_xNMA)on the machine via SSH results in a successful JSON response, however doing  
> > the same from a machine external to AWS using the external ip or host fails.
> > 
> > On startup, I can see ES binding to the internal address, which I would  
> > assume would be NAT'd by AWS from the external.
> > 
> > 2013-11-24 13:11:51,094][INFO][http] [Azazel] bound\_address  
> > {inet[/0:0:0:0:0:0:0:0:9200]}, publish\_address {inet[/172.31.42.186:9200[http://www.google.com/url?q=http%3A%2F%2F172.31.42.186%3A9200&sa=D&sntz=1&usg=AFQjCNGeOdnBtGglutBnnTwVGlS7E\_xNMA](http://www.google.com/url?q=http%3A%2F%2F172.31.42.186%3A9200&sa=D&sntz=1&usg=AFQjCNGeOdnBtGglutBnnTwVGlS7E_xNMA)  
> > ]}
> > 
> > Can anyone advise?
> > 
> > Regards, Ben.
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![simpsora](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/simpsora/32/647_2.png) [@simpsora](https://discuss.elastic.co/u/simpsora)\
**Post date:** [November 25, 2013, 4:28am UTC](https://discuss.elastic.co/t/aws-unable-to-connect-to-ec2-instance-publically/14565/4 "2013-11-25T04:28:52Z")

</div>

Is your ES node running in EC2 classic, or within a VPC? If in a VPC,  
there may be Network ACLs (separate to security groups) defined on the VPC  
which limit inbound access to nodes in that VPC.

If not running in a VPC, how have you configured networking? Does the node  
have an ENI & EIP configured? Can you access other services/ports on the  
host from the outside world? Any iptables rules blocking access?

Ross

On Monday, 25 November 2013 00:14:26 UTC+11, Ben wrote:

> I have a single node of ES running on a CentOS EC2 environment.
> 
> I wish to connect to the node remotely via the public internet, however am  
> unable to access using either the public ip or hostname.
> 
> My /config/elasticsearch.yml has the following entrances:
> 
> cluster.name[http://www.google.com/url?q=http%3A%2F%2Fcluster.name&sa=D&sntz=1&usg=AFQjCNGbdss-\_rGgAY2He8KM6ZUy2TdG8g](http://www.google.com/url?q=http%3A%2F%2Fcluster.name&sa=D&sntz=1&usg=AFQjCNGbdss-_rGgAY2He8KM6ZUy2TdG8g):  
> test-cluster  
> cloud:  
> aws:  
> access\_key: \<my\_key\>  
> secret\_key: \<my\_secret\>  
> discovery:  
> type: ec2
> 
> I have opened all ports for all traffic (for testing purposes) within the  
> EC2 security group.
> 
> Running: curl 172.31.42.186:9200[http://www.google.com/url?q=http%3A%2F%2F172.31.42.186%3A9200&sa=D&sntz=1&usg=AFQjCNGeOdnBtGglutBnnTwVGlS7E\_xNMA](http://www.google.com/url?q=http%3A%2F%2F172.31.42.186%3A9200&sa=D&sntz=1&usg=AFQjCNGeOdnBtGglutBnnTwVGlS7E_xNMA)on the machine via SSH results in a successful JSON response, however doing  
> the same from a machine external to AWS using the external ip or host fails.
> 
> On startup, I can see ES binding to the internal address, which I would  
> assume would be NAT'd by AWS from the external.
> 
> 2013-11-24 13:11:51,094][INFO][http] [Azazel] bound\_address  
> {inet[/0:0:0:0:0:0:0:0:9200]}, publish\_address {inet[/172.31.42.186:9200[http://www.google.com/url?q=http%3A%2F%2F172.31.42.186%3A9200&sa=D&sntz=1&usg=AFQjCNGeOdnBtGglutBnnTwVGlS7E\_xNMA](http://www.google.com/url?q=http%3A%2F%2F172.31.42.186%3A9200&sa=D&sntz=1&usg=AFQjCNGeOdnBtGglutBnnTwVGlS7E_xNMA)  
> ]}
> 
> Can anyone advise?
> 
> Regards, Ben.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Ben\_3](https://avatars.discourse-cdn.com/v4/letter/b/e36b37/32.png) [@Ben\_3](https://discuss.elastic.co/u/Ben_3)\
**Post date:** [November 25, 2013, 5:28pm UTC](https://discuss.elastic.co/t/aws-unable-to-connect-to-ec2-instance-publically/14565/5 "2013-11-25T17:28:32Z")

</div>

Hi Ross,

Any iptables rules blocking access?

You Sir are a star! IP tables was blocking my ports. Been so long since I  
have used CentOS, I completely forgot to check.

Many thanks, Ben.

On Monday, November 25, 2013 4:28:52 AM UTC, Ross Simpson wrote:

> Is your ES node running in EC2 classic, or within a VPC? If in a VPC,  
> there may be Network ACLs (separate to security groups) defined on the VPC  
> which limit inbound access to nodes in that VPC.
> 
> If not running in a VPC, how have you configured networking? Does the  
> node have an ENI & EIP configured? Can you access other services/ports on  
> the host from the outside world? Any iptables rules blocking access?
> 
> Ross
> 
> On Monday, 25 November 2013 00:14:26 UTC+11, Ben wrote:
> 
> > I have a single node of ES running on a CentOS EC2 environment.
> > 
> > I wish to connect to the node remotely via the public internet, however  
> > am unable to access using either the public ip or hostname.
> > 
> > My /config/elasticsearch.yml has the following entrances:
> > 
> > cluster.name[http://www.google.com/url?q=http%3A%2F%2Fcluster.name&sa=D&sntz=1&usg=AFQjCNGbdss-\_rGgAY2He8KM6ZUy2TdG8g](http://www.google.com/url?q=http%3A%2F%2Fcluster.name&sa=D&sntz=1&usg=AFQjCNGbdss-_rGgAY2He8KM6ZUy2TdG8g):  
> > test-cluster  
> > cloud:  
> > aws:  
> > access\_key: \<my\_key\>  
> > secret\_key: \<my\_secret\>  
> > discovery:  
> > type: ec2
> > 
> > I have opened all ports for all traffic (for testing purposes) within the  
> > EC2 security group.
> > 
> > Running: curl 172.31.42.186:9200[http://www.google.com/url?q=http%3A%2F%2F172.31.42.186%3A9200&sa=D&sntz=1&usg=AFQjCNGeOdnBtGglutBnnTwVGlS7E\_xNMA](http://www.google.com/url?q=http%3A%2F%2F172.31.42.186%3A9200&sa=D&sntz=1&usg=AFQjCNGeOdnBtGglutBnnTwVGlS7E_xNMA)on the machine via SSH results in a successful JSON response, however doing  
> > the same from a machine external to AWS using the external ip or host fails.
> > 
> > On startup, I can see ES binding to the internal address, which I would  
> > assume would be NAT'd by AWS from the external.
> > 
> > 2013-11-24 13:11:51,094][INFO][http] [Azazel] bound\_address  
> > {inet[/0:0:0:0:0:0:0:0:9200]}, publish\_address {inet[/172.31.42.186:9200[http://www.google.com/url?q=http%3A%2F%2F172.31.42.186%3A9200&sa=D&sntz=1&usg=AFQjCNGeOdnBtGglutBnnTwVGlS7E\_xNMA](http://www.google.com/url?q=http%3A%2F%2F172.31.42.186%3A9200&sa=D&sntz=1&usg=AFQjCNGeOdnBtGglutBnnTwVGlS7E_xNMA)  
> > ]}
> > 
> > Can anyone advise?
> > 
> > Regards, Ben.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:04am UTC](https://discuss.elastic.co/t/aws-unable-to-connect-to-ec2-instance-publically/14565/6 "2017-07-06T02:04:56Z")

</div>


