Chuck Aguilar
Chuck Aguilar

Reputation: 2048

Connection Refused from AWS instance even after changing Inbound Rules

I know, that when someone says that he gets a Connection Refuse Error trying to connect to AWS, the first is that he usually didn't change the Inbound Rules in the Security Group.

Well, I installed Elasticsearch in an Instance, and that's why I need to have the port 9200 free, at least from my office IP.

I did it, as it can be sawed here: here

Where the port 9200 should be open for the ES (Elastic Search) Security Group, which is the Security Group of the Instance. 88.217.142.163 is the IP of my Office and 172.31.0.0/16 are the private IPs of AWS.

But when I try this: curl -XGET '35.156.142.21:9200', which is the instance IP, I get this:

curl: (7) Failed to connect to 35.156.142.21 port 9200: Connection refused

I'm sure that 88.217.142.163 is my IP.

I tried this curl -XGET 'localhost:9200' inside the instance via ssh(BTW, ssh works perfectly) and I get this:

{
  "name" : "HH0nrrR",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "W1BMrQ_OTnG4N48y6zhqcw",
  "version" : {
    "number" : "5.3.0",
    "build_hash" : "3adb13b",
    "build_date" : "2017-03-23T03:31:50.652Z",
    "build_snapshot" : false,
    "lucene_version" : "6.4.1"
  },
  "tagline" : "You Know, for Search"
}

So, quite good. The only problem is with the 9200 port from my office.

I don't know if I have to wait more time, I waited like 2 hours or so, and I still get the connection refused error.

Maybe someone had the same error.

Upvotes: 1

Views: 2686

Answers (1)

Chuck Aguilar
Chuck Aguilar

Reputation: 2048

I just had to change the elasticsearch.yml in /etc/elasticsearch and there as here says:

doc

The network.host change. By default has Elasticsearch just the localhost.

Many thanks to Mark B for the Idea!

Upvotes: 1

Related Questions