AWS now allows you to export all or specific security group rules in a region in CSV format. Follow the below steps to export all security group rules in AWS.
Step 1: Log in to the AWS management console.
Step 2: Select the region and navigate to VPC => Security Groups. Select all or specific security groups and click on “Export security group inbound/outbound rules to CSV” to export security group rules.
It will automatically download a CSV file containing your security group’s inbound and outbound rules.