Skip to content

Instantly share code, notes, and snippets.

View yayohei's full-sized avatar

Yohei Yamamoto yayohei

View GitHub Profile
@yayohei
yayohei / sg_get_all.sh
Last active August 14, 2023 06:09
get all security group
aws ec2 describe-network-interfaces | \
jq -r '.NetworkInterfaces[] | ((if .Attachment.InstanceId? then "ec2" else .Description end) | split(":")[0:3] | join(":") | split(" ")[0:3] | join(" ")) as $desc | .Groups[] | [$desc, .GroupName, .GroupId] | @tsv' | \
sort | \
uniq