yugantar
yugantar

Reputation: 2200

S3 - Access Denied after uploading 100% image

This is the CORS Configuration on S3

<CORSConfiguration>
<CORSRule xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
    <AllowedOrigin>*</AllowedOrigin>
    <AllowedMethod>GET</AllowedMethod>
    <AllowedMethod>POST</AllowedMethod>
    <AllowedMethod>PUT</AllowedMethod>
    <AllowedHeader>*</AllowedHeader>
</CORSRule>
</CORSConfiguration>

This is the Bucket Policy

{
    "Id": "<policyID>",
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "<stm>",
            "Action": "s3:*",
            "Effect": "Allow",
            "Resource": "arn:aws:s3:::<bucket-name>/*",
            "Principal": {
                "AWS": [
                    "arn:aws:iam::<id>:user/<name>"
                ]
            }
        }
    ]
}

My IAM user has the full access

Full Access

The Option request before the PUT returns a 200, so I am assuming the CORS has no configuration errors.

PUT request to the Signed URL for Uploading an image is returning with error

The image starts uploading, and the progress is as follows:

Upload progress: 56% Uploading 
Upload progress: 75% Uploading 
Upload progress: 84% Uploading 
Upload progress: 94% Uploading 
Upload progress: 100% Finalizing
Upload error: Upload error: 403

Response Error from amazonaws:

<Error><Code>AccessDenied</Code><Message>Access Denied</Message><RequestId>REQid</RequestId><HostId>SomeID</HostId></Error>

After 100% Finalizing it throws a 403 error. I am using react-s3-uploader to upload the files to S3.

What am I doing wrong?

Upvotes: 0

Views: 803

Answers (1)

yugantar
yugantar

Reputation: 2200

I found the error. The error was on my end related to Public Access Settings for ACLs. I was marking Block new public ACLs and uploading public objects True instead of False.

Upvotes: 2

Related Questions