Usually, with EC2s we need to open multiple ports between machines. However, it's better to attach security group per port or set of ports - so that they can be used to define minimum access The terraform script can help rapid prototyping using AWS Security Groups and can even be exted to add more security groups for additional access control.
Enjoy!