Reusable
Reusable

Reputation: 1948

aws s3Client PutObject Access Denied, but CyberDuck can PutObject Successfully

Im facing a mystery on S3 bucket policy, and it is preventing my a Php S3Client from PutObject. The error im getting is:

Error executing "PutObject" on "https://s3.amazonaws.com/reusable-system-dev/b1e42024e33d62b852d3c94c85f68c72.jpeg"; AWS HTTP error: Client error response [url] https://s3.amazonaws.com/reusable-system-dev/b1e42024e33d62b852d3c94c85f68c72.jpeg [status code] 403 [reason phrase] Forbidden AccessDenied (client): Access Denied

But, with the same Access key and Secret key, i can PutObject using a CyberDuck client! Is there any hidden S3 policy that could cause such a strange behavior?

Upvotes: 3

Views: 1226

Answers (4)

Der_Meister
Der_Meister

Reputation: 5027

I got the error because of CannedACL usage (requires PutObjectAcl permission).

Upvotes: 0

Aslan Brooke
Aslan Brooke

Reputation: 497

I've seen this exact symptom before. The issue may be with the date/time stamp being generated by the s3client in your Php code. Turn on debugging for the s3client and see if the date/time stamp in the request is being produced with "GMT" (correct) or something else. If its something else, that could be the issue, you could compare it to CyberDuck if it will show you the debug output for the request its making.

Upvotes: 2

Arash
Arash

Reputation: 314

PutObject:

Note:

To configure your application to send the Request Headers prior to sending the request body, use the 100-continue HTTP status code

Upvotes: 1

Shyam Achuthan
Shyam Achuthan

Reputation: 950

This may be due to wrong authentication. Make sure you are authenticating perfectly.

One way to test is try to access some restricted/private resource from S3 through s3 client.

Upvotes: 1

Related Questions