core icon indicating copy to clipboard operation
core copied to clipboard

AWS s3 in Frankfurt

Open filippouni opened this issue 12 years ago • 15 comments

Hello, when creating a new S3 bucket in Frankfurt, OC (ownCloud 7.0.2) files_external give error, instead with a bucket in Ireland is well working. Reading AWS documentation I have found: "Any new regions after January 30, 2014 will support only Signature Version 4" cfr: http://docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-authenticating-requests.html There is some trouble with this new region ? Regards, Filippo

filippouni avatar Nov 07 '14 09:11 filippouni

@butonic

LukasReschke avatar Nov 07 '14 09:11 LukasReschke

Not sure, but I noticed before that the S3 library got upgraded on master, maybe it already works there.

PVince81 avatar Nov 07 '14 11:11 PVince81

No, but upgrading to the latest AWS SDK for PHP (2.7.3) and with the right region (eu-central-1) it works. Without region doesn't work.

filippouni avatar Nov 07 '14 14:11 filippouni

Do you mean the S3 external storage should auto-detect the region ? From what I saw in the code the default is always "eu-west-1" if no region is specified: https://github.com/owncloud/core/blob/master/apps/files_external/lib/amazons3.php#L111

PVince81 avatar Nov 10 '14 08:11 PVince81

Excuse my English, but what I mean are two thinks:

  1. With the original (of OC) aws library there is an error mounting S3 bucket "The authorization mechanism you have provided is not supported. Please use AWS4-HMAC-SHA256" this because new region,like eu-central-1, will support only Signature Version 4. This could be fixed upgrading external lib to AWS SDK for PHP version 2.7.3.
  2. I don't know if the library could auto-detect the region, but now in Europe there are two region: eu-central-1 and eu-west-1, probably with different privacy laws. From the user point of view on the GUI there is "region (Optional)" but it is not optional using the region eu-central-1,because without insert the region the mounting process not works.

filippouni avatar Nov 10 '14 09:11 filippouni

So I guess we should make "Region" a mandatory field for S3 ?

It looks like on master the AWS SDK is currently on version 2.6.15, which was upgraded recently by @helmutschneider

PVince81 avatar Nov 10 '14 10:11 PVince81

I am not up to speed regarding the new eu region or its sdk-requirements.. but I can certainly upgrade master to 2.7.3 since it appears to be fully backwards-compatible :)

helmutschneider avatar Nov 10 '14 10:11 helmutschneider

@helmutschneider that would be awesome, thanks :smile:

PVince81 avatar Nov 10 '14 10:11 PVince81

It appears the aws sdk has problems with the new V4 signatures no matter which version you are using. Just tested 2.7.3 against eu-west-1 and it ran perfectly - against eu-central-1, not so much. 16 tests fail with the following error:

Aws\S3\Exception\S3Exception: AWS Error Code: XAmzContentSHA256Mismatch, Status Code: 400, AWS Request ID: 85B46F11CF55B606, AWS Error Type: client, AWS Error Message: The provided 'x-amz-content-sha256' header does not match what was computed., User-Agent: aws-sdk-php2/2.7.3 Guzzle/3.8.1 curl/7.37.1 PHP/5.5.14

Also found this: aws/aws-sdk-php#393

helmutschneider avatar Nov 11 '14 15:11 helmutschneider

The amazon guys quickly fixed the issue :) PR done

helmutschneider avatar Nov 13 '14 22:11 helmutschneider

Wow, very cool :smile: Thanks a lot for sorting this out!

PVince81 avatar Nov 14 '14 09:11 PVince81

Will be fixed with 8.0

LukasReschke avatar Dec 05 '14 19:12 LukasReschke

S3 buckets locatet in Frankfurt do not work with owncloud 8.0 - only if you add "eu-central-1" as region ...I guess this behaviour isn't bulletproof as you don't have to add that information for, let's say, a bucket locatet in Ireland.

Styg82 avatar Feb 27 '15 16:02 Styg82

Still ?

Can you post your log ?

PVince81 avatar Feb 27 '15 16:02 PVince81

UPDATE: Apologies on the below, I accidentally added the region to the credentials array when initializing. All good now.

~~Same. Here's what I get:~~

~~PHP Fatal error: Uncaught Aws\S3\Exception\InvalidRequestException: AWS Error Code: InvalidRequest, Status Code: 400, AWS Request ID: 054C4849D34356DB, AWS Error Type: client, AWS Error Message: The authorization mechanism you have provided is not supported. Please use AWS4-HMAC-SHA256., User-Agent: aws-sdk-php2/2.7.21 Guzzle/3.9.2 curl/7.22.0 PHP/5.3.10-1ubuntu3.15 ITR thrown in /user/src/aws/aws_client/Aws/Common/Exception/NamespaceExceptionFactory.php on line 91~~

AviBueno avatar Mar 09 '15 16:03 AviBueno