I tried to open ports, set instances to the same security group and nothing is working, I can ping from one instance to another with success, but I can’t connect via Node.connect.
I’ve tried to use EPMD and GOSSIP. Cookie is the same for both EC2 instances. I can ping from one to another, but unfortunately I think there’s something missing to connect both.
I thought by default EC2 VPC doesn’t support broadcasting, and without it you’d have to know each instance dns name to connect to it. That is why there was libcluster ec2 strategy that was listing instances by tag
Gossip Works, but only in the same host… in my case, even my own host was not working.
libcluster ec2 works, but you need to expose your security via ex_aws and it will ping your tags every 2 or 3 seconds to get the list of private or public ips you have.
Don’t know if this works with EC2 or just Fargate, but AWS now offers DNS-based service discovery which can be hooked into libcluster so you don’t have to rely on tags, etc. See Libcluster in docker on aws elastic beanstalk - can't create a cluster for details. Again, I only tried on Fargate and it was super-simple…dunno if that translates to raw EC2 instances or not.