title: Access denied when uploading S3 Objects
body: <p>I'm following <a href="https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/s3-example-photo-album.html" rel="nofollow noreferrer">this</a> tutorial of adding/listing objects from S3.</p>
  
  <p>At first, I had problem to list objects because of <code>Access Denied</code> error, so I found that I have to to add additional permission <code>s3:ListBucket</code> and resource <code>arn:aws:s3:::my-bucket</code> to the role created by <strong>cognito to unauth user</strong>:</p>
  
  <pre><code>{
      "Version": "2012-10-17",
      "Statement": [
          {
              "Effect": "Allow",
              "Action": [
                  "s3:PutObject",
                  "s3:GetObject",
                  "s3:ListBucket",
                  "s3:DeleteObject"
              ],
              "Resource": [
                  "arn:aws:s3:::my-bucket",
                  "arn:aws:s3:::my-bucket/*"
              ]
          }
      ]
  }
  </code></pre>
  
  <p>Now, when I try to upload a file, I'm getting another <code>Access Denied</code>.</p>
  
  <p>Am I doing something wrong or this tutorial has so many errors?</p>
  
  <p>Additional Checks:</p>
  
  <ul>
  <li>bucket has CORS</li>
  <li><strong>I didn't change any permissions of bucket after creating it (everything default)</strong></li>
  <li>I'm using proper Cognito Identity Pool ID ( I can list albmus )</li>
  <li>I can delete album</li>
  <li>After <code>Access Denied</code> error I can see that there is new identity in cognito unauth, so script works properly.</li>
  <li>Owner of the bucket (me) has read/write access to the bucket</li>
  </ul>