What function do security groups serve related Amazon Elastic Compute Cloud (Amazon EC2) instance security?
AWS Security Groups act like a firewall for your Amazon EC2 instances controlling both inbound and outbound traffic. When you launch an instance on AmazonEC2, you need to assign it to a particular security group.After that, you can set up ports and protocols, which remain open for users and computers over the internet.AWS Security Groups are very flexible. You can use the default security group and still customize it according to your liking (although we don't recommend this practice because groups should be named according to their purpose.) Or you can create a security group that you want for your specific applications. To do this, you can write the corresponding code or use the Amazon EC2 console to make the process easier.https://www.threatstack.com/blog/aws-security-groups-what-they-are-and-how-to-get-the-most-out-of-them