title: boto3 giving Access Denied error while uploading file through python
body: <p>When I tried uploading an image to s3 using boto3 in python I am constantly getting errors.
  The error says:</p>
  <pre class="lang-py prettyprint-override"><code>An error occurred (AccessDenied) when calling the PutObject operation: Access Denied
  </code></pre>
  <p>My code for uploading the image is</p>
  <pre class="lang-py prettyprint-override"><code>def upload_file(file_name, bucket, object_name=None):
      &quot;&quot;&quot;Upload a file to an S3 bucket
  
      :param file_name: File to upload
      :param bucket: Bucket to upload to
      :param object_name: S3 object name. If not specified then file_name is used
      :return: True if file was uploaded, else False
      &quot;&quot;&quot;
  
      # If S3 object_name was not specified, use file_name
      if object_name is None:
          object_name = file_name
  
      # Upload the file
      s3_client = boto3.client('s3')
      try:
          response = s3_client.upload_file(file_name, bucket, object_name, ExtraArgs={'ACL':'public-read'})
          print(response)
      except Exception as e:
          print(e)
          return False
      return True
  
  </code></pre>