Created
September 26, 2022 10:42
-
-
Save Voronenko/f77bdd5d19c28990816777d1712d6e3d to your computer and use it in GitHub Desktop.
DOES NOT take into consid. LB
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/bash | |
# all groups | |
aws ec2 describe-security-groups \ | |
| jq --raw-output '.SecurityGroups[] | [.GroupName, .GroupId] | @tsv' \ | |
| sort > /tmp/sg.all | |
# groups in use | |
aws ec2 describe-network-interfaces \ | |
| jq --raw-output '.NetworkInterfaces[].Groups[] | [.GroupName, .GroupId] | @tsv' \ | |
| sort \ | |
| uniq > /tmp/sg.in.use | |
diff /tmp/sg.all /tmp/sg.in.use |grep "<" |cut -d ' ' -f2-3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment