title: An error occurred (AccessDenied) when calling the CopyObject operation: Access Denied
body: <p>I am getting this error when using <code>copy_object</code> method of boto3 when running my Python code in AWS Lambda.</p>
  <p><strong>AWS Lambda Code</strong></p>
  <pre><code>import json
  import boto3
  
  def lambda_handler(event, context):
      some_binary_data = b'Here we have some data'
      client = boto3.client(&quot;s3&quot;)
  
      # Upload - Working
      client.put_object(Body=some_binary_data, Bucket='test', Key=&quot;upload/binary_1.txt&quot;)
      
      # Copy - Working
      s3 = boto3.resource('s3')
      copy_source = {
          'Bucket': 'test',
          'Key': 'upload/binary_1.txt'
      }
      s3.meta.client.copy(copy_source, 'test', 'upload/binary_1_copied.txt')
  
      # Copy - NOT WORKING  
      # Access Denied even after adding GetObjectTagging and PutObjectTagging permissions in the policy
  
      client.copy_object(Bucket=&quot;test&quot;, CopySource=&quot;upload/binary_1.txt&quot;, Key=&quot;upload/binary_1_copied.txt&quot;)
  
      # Delete - Working
      client.delete_object(Bucket=&quot;test&quot;, Key=&quot;upload/binary_1.txt&quot;)
      
      return {
          'statusCode': 200,
          'body': json.dumps('Hello from Lambda!')
      }
  </code></pre>
  <p>I am using this policy (mentioned as JSON) for the role assigned to my lambda function.</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:ReplicateObject&quot;,
              &quot;s3:PutObject&quot;,
              &quot;s3:GetObject&quot;,
              &quot;s3:GetObjectTagging&quot;,
              &quot;s3:ListBucket&quot;,
              &quot;s3:PutObjectTagging&quot;,
              &quot;s3:DeleteObject&quot;,
              &quot;s3:PutObjectAcl&quot;
          ],
          &quot;Resource&quot;: [
              &quot;arn:aws:s3:::test/*&quot;,
              &quot;arn:aws:s3:::test&quot;
          ]
      },
      {
          &quot;Sid&quot;: &quot;VisualEditor1&quot;,
          &quot;Effect&quot;: &quot;Allow&quot;,
          &quot;Action&quot;: &quot;s3:ListAllMyBuckets&quot;,
          &quot;Resource&quot;: &quot;*&quot;
      }
  ]
  }
  </code></pre>
  <p>Note - S3-Bucket currently contains upload/binary_1.txt file</p>