Thanks for the response!
I get your point on deploying in different regions, but ideally it should get connected across regions as well if we leave latency for the time being.
Also, I am just trying with 2 nodes on trial basis, once I am able to form cluster will use more than 2 for sure.
Talking about the non-public ip address, for that I have already done the VPC peering due to which I can ping these EC2 instances with their private IPs address.
But, am still not able to form a cluster here is the updated commands that I am using:-
Node 1:- sudo docker run -it --pull=always --net elastic -p 9200:9200 -p 9300:9300 -e discovery.type=multi-node -e cluster.name="my-elasticsearch-cluster" -e node.name="node-1" -e node.roles="master" -e discovery.seed_hosts=["192.168.0.136","10.0.0.211","10.0.0.228"] -e xpack.security.enabled=false -e xpack.ml.enabled=false -e network.host="0.0.0.0" -e cluster.initial_master_nodes=["node-1","node-2","node-3"] -e ES_JAVA_OPTS="-Xms1g -Xmx1g" docker.elastic.co/elasticsearch/elasticsearch:8.7.0
{"@timestamp":"2023-06-01T12:01:15.741Z", "log.level": "WARN", "message":"completed handshake with [{node-3}{chP4VsW5Tf-CgF_vMXO37w}{gF53WQ38Tgu5PqbF9t01qg}{node-3}{172.19.0.2}{172.19.0.2:9300}{m}{8.7.0}] at [10.0.0.228:9300] but followup connection to [172.19.0.2:9300] failed", "ecs.version": "1.2.0","service.name":"ES_ECS","event.dataset":"elasticsearch.server","process.thread.name":"elasticsearch[node-1][generic][T#4]","log.logger":"org.elasticsearch.discovery.HandshakingTransportAddressConnector","elasticsearch.node.name":"node-1","elasticsearch.cluster.name":"my-elasticsearch-cluster","error.type":"org.elasticsearch.transport.ConnectTransportException","error.message":"[node-3][172.19.0.2:9300] connect_timeout[30s]","error.stack_trace":"org.elasticsearch.transport.ConnectTransportException: [node-3][172.19.0.2:9300] connect_timeout[30s]\n\tat org.elasticsearch.server@8.7.0/org.elasticsearch.transport.TcpTransport$ChannelsConnectedListener.onTimeout(TcpTransport.java:1157)\n\tat org.elasticsearch.server@8.7.0/org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingRunnable.run(ThreadContext.java:891)\n\tat java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)\n\tat java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)\n\tat java.base/java.lang.Thread.run(Thread.java:1589)\n"}
{"@timestamp":"2023-06-01T12:01:15.741Z", "log.level": "WARN", "message":"address [10.0.0.228:9300], node [null], requesting [false] discovery result: [node-3][172.19.0.2:9300] connect_timeout[30s]", "ecs.version": "1.2.0","service.name":"ES_ECS","event.dataset":"elasticsearch.server","process.thread.name":"elasticsearch[node-1][generic][T#4]","log.logger":"org.elasticsearch.discovery.PeerFinder","elasticsearch.node.name":"node-1","elasticsearch.cluster.name":"my-elasticsearch-cluster"}