UPD: modified list-unused-sg.sh with TMPFILE variable
This commit is contained in:
parent
1ddc2f2fe0
commit
d2bf566588
|
@ -1,9 +1,10 @@
|
|||
#!/bin/bash
|
||||
|
||||
aws ec2 describe-network-interfaces --query NetworkInterfaces[].Groups --output text > /tmp/enisg.lst
|
||||
TMPFILE=/dev/shm/enisg.lst
|
||||
aws ec2 describe-network-interfaces --query NetworkInterfaces[].Groups --output text > $TMPFILE
|
||||
for sg in $(aws ec2 describe-security-groups --query 'SecurityGroups[*].GroupId' --output text); do
|
||||
echo -n "$sg : "
|
||||
grep -c $sg /tmp/enisg.lst
|
||||
grep -c $sg $TMPFILE
|
||||
done | sort -k3 -n
|
||||
|
||||
rm -f /tmp/enisg.lst
|
||||
rm -f $TMPFILE
|
||||
|
|
Loading…
Reference in New Issue