Skip to content

Instantly share code, notes, and snippets.

@dbt4u
Created September 24, 2019 16:58
Show Gist options
  • Save dbt4u/b957ba191ddad59da42e486977736654 to your computer and use it in GitHub Desktop.
Save dbt4u/b957ba191ddad59da42e486977736654 to your computer and use it in GitHub Desktop.
aws ec2 describe-security-groups | jq '[ .SecurityGroups[].IpPermissions[] as $a | { "ports": [($a.FromPort|tostring),($a.ToPort|tostring)]|unique, "cidr": $a.IpRanges[].CidrIp } ] | [group_by(.cidr)[] | { (.[0].cidr): [.[].ports|join("-")]|unique }] | add'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment