You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@jclouds.apache.org by "Andrew Gaul (JIRA)" <ji...@apache.org> on 2017/01/11 03:23:58 UTC

[jira] [Comment Edited] (JCLOUDS-1213) S3: Region is not respected

    [ https://issues.apache.org/jira/browse/JCLOUDS-1213?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15816968#comment-15816968 ] 

Andrew Gaul edited comment on JCLOUDS-1213 at 1/11/17 3:23 AM:
---------------------------------------------------------------

[~halvdanhg] Can you provide a complete test case?  I successfully executed:

{code:java}
Location location = Iterables.tryFind(blobStore.listAssignableLocations(),
        LocationPredicates.idEquals(Region.EU_CENTRAL_1)).orNull();
assertNotNull(location);
blobStore.createContainerInLocation(location, containerName);
blobStore.createContainerInLocation(location, containerName);
String blobName = "test-blob";
Blob blob = blobStore.blobBuilder(blobName).payload("something").build();
blobStore.putBlob(containerName, blob);
blobStore.removeBlob(containerName, blobName);
{code}

I verified the correct region was set by disabling virtual host buckets and examining the wire logs:

{code}
>> PUT https://s3.amazonaws.com/gaul-blobstore2eu HTTP/1.1
>> Authorization: AWS4-HMAC-SHA256 Credential=AKIAITMZ4YFWHBLA4KMA/20170111/us-east-1/s3/aws4_request, SignedHeaders=content-length;content-type;host;x-amz-content-sha256;x-amz-date, Signature=07f890b1f2629b2cc49153aeab3a190fc5874d529d4bb890077dc4702bfc458f

<< HTTP/1.1 200 OK

>> PUT https://s3.amazonaws.com/gaul-blobstore2eu HTTP/1.1
>> Authorization: AWS4-HMAC-SHA256 Credential=AKIAITMZ4YFWHBLA4KMA/20170111/us-east-1/s3/aws4_request, SignedHeaders=content-length;content-type;host;x-amz-content-sha256;x-amz-date, Signature=07f890b1f2629b2cc49153aeab3a190fc5874d529d4bb890077dc4702bfc458f

<< HTTP/1.1 409 Conflict
<< x-amz-bucket-region: eu-central-1

>> GET https://s3.amazonaws.com/gaul-blobstore2eu?location HTTP/1.1
>> Authorization: AWS4-HMAC-SHA256 Credential=AKIAITMZ4YFWHBLA4KMA/20170111/us-east-1/s3/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-date, Signature=2321d91d99430526251e82bbaab748a97cb0cc1a1d6bfce763a5b2b20a10b148

<< HTTP/1.1 200 OK

>> PUT https://s3-eu-central-1.amazonaws.com/gaul-blobstore2eu/test-blob HTTP/1.1
>> Authorization: AWS4-HMAC-SHA256 Credential=AKIAITMZ4YFWHBLA4KMA/20170111/eu-central-1/s3/aws4_request, SignedHeaders=content-length;content-type;host;x-amz-content-sha256;x-amz-date, Signature=b96ac1928ba38a063caa7c2a80f484007dce843eae6a8bc35ade1abd134b967e

<< HTTP/1.1 200 OK

>> DELETE https://s3-eu-central-1.amazonaws.com/gaul-blobstore2eu/test-blob HTTP/1.1
>> Authorization: AWS4-HMAC-SHA256 Credential=AKIAITMZ4YFWHBLA4KMA/20170111/eu-central-1/s3/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-date, Signature=25f6f0b552266b790a996577321620349ce654a3cd66932ea899f863966f06cb

<< HTTP/1.1 204 No Content
{code}


was (Author: gaul):
[~halvdanhg] Can you provide a complete test case?  I successfully executed:

{code:java}
Location location = Iterables.tryFind(blobStore.listAssignableLocations(),
        LocationPredicates.idEquals(Region.EU_CENTRAL_1)).orNull();
blobStore.createContainerInLocation(location, containerName);
blobStore.createContainerInLocation(location, containerName);
String blobName = "test-blob";
Blob blob = blobStore.blobBuilder(blobName).payload("something").build();
blobStore.putBlob(containerName, blob);
blobStore.removeBlob(containerName, blobName);
{code}

I verified the correct region was set by disabling virtual host buckets and examining the wire logs:

{code}
>> PUT https://s3.amazonaws.com/gaul-blobstore2eu HTTP/1.1
>> Authorization: AWS4-HMAC-SHA256 Credential=AKIAITMZ4YFWHBLA4KMA/20170111/us-east-1/s3/aws4_request, SignedHeaders=content-length;content-type;host;x-amz-content-sha256;x-amz-date, Signature=07f890b1f2629b2cc49153aeab3a190fc5874d529d4bb890077dc4702bfc458f

<< HTTP/1.1 200 OK

>> PUT https://s3.amazonaws.com/gaul-blobstore2eu HTTP/1.1
>> Authorization: AWS4-HMAC-SHA256 Credential=AKIAITMZ4YFWHBLA4KMA/20170111/us-east-1/s3/aws4_request, SignedHeaders=content-length;content-type;host;x-amz-content-sha256;x-amz-date, Signature=07f890b1f2629b2cc49153aeab3a190fc5874d529d4bb890077dc4702bfc458f

<< HTTP/1.1 409 Conflict
<< x-amz-bucket-region: eu-central-1

>> GET https://s3.amazonaws.com/gaul-blobstore2eu?location HTTP/1.1
>> Authorization: AWS4-HMAC-SHA256 Credential=AKIAITMZ4YFWHBLA4KMA/20170111/us-east-1/s3/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-date, Signature=2321d91d99430526251e82bbaab748a97cb0cc1a1d6bfce763a5b2b20a10b148

<< HTTP/1.1 200 OK

>> PUT https://s3-eu-central-1.amazonaws.com/gaul-blobstore2eu/test-blob HTTP/1.1
>> Authorization: AWS4-HMAC-SHA256 Credential=AKIAITMZ4YFWHBLA4KMA/20170111/eu-central-1/s3/aws4_request, SignedHeaders=content-length;content-type;host;x-amz-content-sha256;x-amz-date, Signature=b96ac1928ba38a063caa7c2a80f484007dce843eae6a8bc35ade1abd134b967e

<< HTTP/1.1 200 OK

>> DELETE https://s3-eu-central-1.amazonaws.com/gaul-blobstore2eu/test-blob HTTP/1.1
>> Authorization: AWS4-HMAC-SHA256 Credential=AKIAITMZ4YFWHBLA4KMA/20170111/eu-central-1/s3/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-date, Signature=25f6f0b552266b790a996577321620349ce654a3cd66932ea899f863966f06cb

<< HTTP/1.1 204 No Content
{code}

> S3: Region is not respected
> ---------------------------
>
>                 Key: JCLOUDS-1213
>                 URL: https://issues.apache.org/jira/browse/JCLOUDS-1213
>             Project: jclouds
>          Issue Type: Bug
>          Components: jclouds-blobstore
>    Affects Versions: 2.0.0
>            Reporter: Halvdan Hoem Grelland
>              Labels: aws-s3
>
> When using a BlobStore configured for the 'aws-s3' provider and with an explicit region ('eu-west-1' in this case), _BlobStore.createContainerInLocation(Location location, String container)_ fails with a 400 when attempting to create an already existing bucket on that location.
> The error message from AWS claims the cause to be _AuthorizationHeaderMalformed_, and says that 'eu-west-1' was expected, but that 'us-east-1' was supplied in the PUT request.
> I have confirmed that 'eu-west-1' is, in fact, given to the method call, but it does not seem to be respected when forming and signing the request.
> This does not happen on 1.9.x.
> From the debugging i have done a likely culprit seems to be _Aws4SignerForAuthorizationHeader_ which resolves a _ServiceAndRegion_ instance, which in turn seem to attempt parsing the region from the hostname URL (_AWSHostNameUtils.parseRegionName(..)_). I cannot see the region set for the provider being respected in this case.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)