I am getting my feet wet with setting up cloud haskell peers on AWS EC2. I have two linux boxes set up within same VPC that can see each other (don't think UDP multicast is enabled). I tried running a code like below (with actual hostname and port 5010), but it seems that the nodes can't see each other unless they are on the same host:
import System.Environment (getArgs)
import Control.Distributed.Process
import Control.Distributed.Process.Node (initRemoteTable, runProcess)
import Control.Distributed.Process.Backend.SimpleLocalnet
import Control.Monad (forever, forM_)
main = do
[host, port] <- getArgs
backend <- initializeBackend host port initRemoteTable
node <- newLocalNode backend
peers <- findPeers backend 10000000
print $ peers
runProcess node $ forM_ peers $ \peer -> nsendRemote peer "echo-server" "hello!"
What is a simple way for the nodes in same AWS virtual private cloud to see each other in P2P mode? Perhaps I need to open up the firewall ports if the code above is supposed to work across VPC?
I just want to make sure that the code above is supposed to work with AWS ec2 instances on same VPC (and that I don't need distributed-process-p2p module). Then I will go debugging by checking firewall ports etc. after I confirm this from others who are more familiar with this.
Also, I can't figure out from tutorial how the nodes are supposed to see each other through findPeers function. So, will appreciate pointers about this as well.