This is the first in a series of posts related to automating the management and auditing of AWS EC2 Security Groups. This first post will cover how to use SaltStack state files to maintain your security group rules. In the second post, we will use python to populate a database that contains instances. groups, rules and their associations. In the final post, we will create a CLI that will allow you to add/remove rules to security groups and it will push all changes to AWS.
I assume you already have a salt master server setup and understand the basics of using Saltstack. It is beyond the scope of this series of posts to cover installing and/or configuring a salt master. If you have not done this yet or need some additional info on using SaltStack, please visit their official Walk-through.