You need both IN and OUT rules to the same security group. They sit on top of the VPC. If using CloudFormation then this should be in place (port ranges determined by Erlang Distribution setup)
I see you have 2 tasks on the same instance and using awsvpc network mode so this is not a cross-AZ issue as the ENIs will be in the same subnet, however if you wish to spread the workload across multiple AZs later then it is worth checking that routes are in place
Only need to focus on communication between your Tasks, the rest is not relevant to the investigation. But yes if you open a connection to port 443 then locally your traffic probably goes out via an ephemeral port. Can study Ephemeral port - Wikipedia
Erlang distribution by default uses port 4369 for EPMD and between inet_dist_listen_min and inet_dist_listen_max. Can study Erlang Distribution Without epmd in addition