2023-06-07 13:39:37 +08:00
|
|
|
#!/bin/bash
|
|
|
|
|
2023-06-07 13:44:29 +08:00
|
|
|
TMPFILE=/dev/shm/enisg.lst
|
|
|
|
aws ec2 describe-network-interfaces --query NetworkInterfaces[].Groups --output text > $TMPFILE
|
2023-06-07 13:39:37 +08:00
|
|
|
for sg in $(aws ec2 describe-security-groups --query 'SecurityGroups[*].GroupId' --output text); do
|
|
|
|
echo -n "$sg : "
|
2023-06-07 13:44:29 +08:00
|
|
|
grep -c $sg $TMPFILE
|
2023-06-07 13:39:37 +08:00
|
|
|
done | sort -k3 -n
|
|
|
|
|
2023-06-07 13:44:29 +08:00
|
|
|
rm -f $TMPFILE
|