Skip to content

Instantly share code, notes, and snippets.

@yayohei
Last active August 14, 2023 06:09
Show Gist options
  • Save yayohei/81b2753076aaf889c3565bf5c4c4d409 to your computer and use it in GitHub Desktop.
Save yayohei/81b2753076aaf889c3565bf5c4c4d409 to your computer and use it in GitHub Desktop.
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment