Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't access my elasticsearch through public IP in EC2 instance

I have deployed elasticsearch(7.3 version) service on my EC2 instance.

  • After installing when I did curl localhost:9200it gave me correct response but when I accessed the same service by hitting request:http://{{public-ip-address-ec2-instance}}:9200

It is giving error as :

This site can’t be reached : {{public-ip-address-ec2-instance}} connection refused.

  • I have configured security group of EC2 instance by allowing inbound traffic on custom TCP which is set to default elastic search port 9200 and is open to 0.0.0.0/0.

Currently I haven't modified elasticsearch.yml and it has default values only.

So how can I access elasticsearch through public IP of EC2 instance? Do I need to make any changes in elasticsearch configuration file?


1 Answers

So the solution was simply to modify the following settings in elasticsearch.yml:

network.host: 0.0.0.0
discovery.type: single-node

Note: The second setting is only necessary if you have a single node.

like image 104
Val Avatar answered Jan 25 '26 09:01

Val



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!