We have opened TCP ports from 5701 to 5709 and also opened UDP port of 54327 which includes inbound and out bound rules in aws console.
We have enabled multicast mode as true, TCP/IP mode as false in both machines Hazelcast configuration.
And also added the following line in iptables
iptables -A INPUT -m pkttype --pkt-type multicast -j ACCEPT
But two machines Hazelcast cluster members are not connected. Are there any other reasons. Could you please provide if there are any other missed points here.