I made 2 modifications to: /etc/elasticsearch/elasticsearch.yml
network.host: 172.31.1.1
# http.port: 9200 <-- commented
# only included other servers in discovery.seed_hosts
discovery.seed_hosts: ["172.31.1.2", "172.31.1.3"]
Then I kept first node running. stopped elasticsearch on second and third nodes, deleted their data path (content of /var/lib/elasticsearch in my case) and restarted elasticsearch on second and third node and they are now joining the cluster.