title: aws-cli --query parameter
body: <p>I am trying to do a filter using aws query to output 0.0.0.0/0 Ips and find which ports they are coming from however when I do</p>
  <pre><code>aws ec2 describe-security-groups --filters Name=ip-permission.cidr,Values='0.0.0.0/0' --query &quot;SecurityGroups[*].{GN:GroupName,Ports: IpPermissions.FromPorts}&quot; --output json
  </code></pre>
  <p>In the Ports column, it outputs None, since it is not finding that filter and when I do</p>
  <pre><code>aws ec2 describe-security-groups --filters Name=ip-permission.cidr,Values='0.0.0.0/0' --query &quot;SecurityGroups[*].{GN:GroupName,Ports: IpPermissions}&quot; --output json
  </code></pre>
  <p>I get all the Ip Ranges when I only want <em><strong>0.0.0.0/0 and which Port that Open Ip is coming from (FromPort and ToPort</strong></em>). And I don't want to do a filter just for a certain Port because I want to see what port each open Ip is coming from.</p>
  <p>I am not sure why this is not working since the IpPermissions.ToPort and IpPermissions.FromPort are both a filter of aws security groups.</p>