title: How to list files which has certain tag in S3 bucket?
body: <p>Here is my code:</p>
  <pre><code>import json, boto3
  def lambda_handler(event, context):
      client = boto3.client(&quot;s3&quot;, region_name='us-east-1')
      response = client.list_objects(Bucket='test-bucket')
      return response
  </code></pre>
  <p>Above code is working fine for me. But I want to list all objects in the bucket which has a particular tag on the file(object), let's say</p>
  <pre><code>department:finance
  </code></pre>
  <p>I write below policy for it:</p>
  <pre><code>{
      &quot;Version&quot;: &quot;2012-10-17&quot;,
      &quot;Statement&quot;: [
          {
              &quot;Sid&quot;: &quot;VisualEditor0&quot;,
              &quot;Effect&quot;: &quot;Allow&quot;,
              &quot;Action&quot;: &quot;s3:List*&quot;,
              &quot;Resource&quot;: &quot;arn:aws:s3:::mynewbucket1122&quot;,
              &quot;Condition&quot;: {
                  &quot;StringEquals&quot;: {
                      &quot;s3:ExistingObjectTag/department&quot;: &quot;finance&quot;
                  }
              }
          }
      ]
  }
  </code></pre>
  <p>But I am getting errors, how can I get expected result.</p>