Determine if there are an excessive number of security groups in the account
Keeping the number of security groups to a minimum helps reduce the attack surface of an account. Rather than creating new groups with the same rules for each project, common rules should be grouped under the same security groups. For example, instead of adding port 22 from a known IP to every group, create a single “SSH” security group which can be used on multiple instances.
Follow the appropriate remediation steps below to resolve the issue.
Log in to the AWS Management Console.
Select the “Services” option and search for EC2.
Scroll down the left navigation panel and choose “Security Groups” under “Network & Security”.
Check the total number of “Security Groups” at the top left corner available in the selected AWS region.
Repeat steps number 2 - 4 to check the “Security Group” threshold value for other regions. If the total number of running “Security Group” provisioned in your AWS account is greater than 50, the recommended threshold is exceeded. AWS has different threshold values as well depends on the region.
Scroll down the left navigation panel and choose “Security Groups” under “Network & Security” and select the unnecessary/unused “Security Groups” that needs to be removed.
Click on the “Actions” button at the top and click on the “Delete Security Groups” option.
In the “Delete Security Groups” dialogue box click on the “Delete” button to delete the selected “Security Groups”.
Repeat steps number 6 - 8 to remove unused “Security Groups” to prevent accidental authorizations.