NEW: count ENI attached to SG

This commit is contained in:
xpk 2022-11-03 14:59:51 +08:00
parent e210e9e783
commit 23b48999f2
Signed by: xpk
GPG Key ID: CD4FF6793F09AB86
1 changed files with 6 additions and 0 deletions

6
aws/find-unused-sg.sh Executable file
View File

@ -0,0 +1,6 @@
#!/bin/bash
aws ec2 describe-security-groups | jq -cr '.SecurityGroups[].GroupId' | while read s; do
echo -n "$s: "
aws ec2 describe-network-interfaces --filters Name=group-id,Values=$s | jq -cr '[.NetworkInterfaces[].NetworkInterfaceId] | length'
done