title: AWS CLI and JMESPath filter and select on nested properties
body: <p>I want to use the CLI tool, to retrieve the distribution-id of a CloudFront distribution with a specific cname/alias.</p>
  
  <p>This is what I came up with:</p>
  
  <pre><code>aws cloudfront list-distributions --query "DistributionList.Items[?Aliases.Items!='null']|DistributionList.Items[?contains(Aliases.Items,'cname.cdn.mycompany.com') == 'true'].{Id:Id}"
  </code></pre>
  
  <p>I'm not an expert at JMESPath, and I don't understand why my query doesn't return a result. A distribution with the specified domain as alias exists.</p>