1

I want to upload images using php to the S3 bucket.

But I keep getting this error

 The authorization mechanism you have provided is not supported. Please use AWS4-HMAC-SHA256

I have tried to find a solution for this issue. but all solutions suggest using "AWS SDK".

I m aware that I have to set the signature to Version 4 and change the endpoint since my bucket is in Frankfurt.

But I don't know how to customize the class I'm using for uploading.

https://github.com/tpyo/amazon-s3-php-class/blob/master/S3.php

Sam Ben
  • 229
  • 1
  • 5
  • 11

1 Answers1

0

According to this answer:

Using some help I've found the answer, which was a combination of 2 missing pieces (one of which was referred to in the comments):

1) Need to set this:

System.setProperty(SDKGlobalConfiguration.ENABLE_S3_SIGV4_SYSTEM_PROPERTY,

"true");

2) Must set the "endPoint" (which was not required for upload or download):

s3Client.setEndpoint(endpoint);

Optionally it might be useful to also add this:

s3Client.setS3ClientOptions(new S3ClientOptions().withPathStyleAccess(true));
Community
  • 1
  • 1
Bahadir Tasdemir
  • 10,325
  • 4
  • 49
  • 61