title: Does boto3 ec2.instances.filter have equivalent to AWS CLI --query?
body: <p>I started by using the AWS CLI to create a bash script to get the data I wanted about my instances. The main line being:</p>
  
  <pre><code>aws ec2 describe-instances --filter "Name=instance-state-name,Values=running" --query Reservations[*].Instances[*].[PublicDnsName,PublicIpAddress,PrivateIpAddress,BlockDeviceMappings[*].DeviceName] --output text
  </code></pre>
  
  <p>Then I realised I wanted something more complex so switched to python and boto3</p>
  
  <pre><code>ec2 = boto3.resource('ec2')
      instances = ec2.instances.filter(
          Filters = [ {
              'Name' : 'instance-state-name',
              'Values' : [ 'running' ]
          } ]
      )
  for i in instances:
      """ The whole data set is here """
      print(i.public_dns_name)
      print(i.public_ip_address)
      """ etc """
  </code></pre>
  
  <p>I can traverse the response and get the data out but the boto3 version seems quite wasteful as I don't need most of the data that is being returned.</p>
  
  <p>Can I get the boto3 interface to only return the data I am interested in, similar to the way the AWS CLI does using --query? (My assumption here being that the AWS CLI is not just getting the entire response and parsing it).</p>