-
Notifications
You must be signed in to change notification settings - Fork 40
"default region bug" in amazon s3 api results in broken createBucket api calls to S3 for us-east-1 #47
Comments
Thank you for the detailed issue. As a workaround did you try to call the |
Ah, I was thinking AmazonS3Client client was package private, but that's Java, not Groovy. Thanks! Actually, amazonS3Service.client.createBucket(bucketName, '') fails with exception:
And this fails: and this is ok: One should note that Amazon put a hack into their Region enum to make this work. US_Standard evaluates to null in String form instead of 'us-east-1'. However the rest of the Regions
So, the String, 'us-east-1', is not accepted by the Amazon S3 api.
|
It should be fixed in 2.1.11. |
Amazon has an undocumented quirk in their s3 api. (I call it a bug.)
Sending the default region in the s3 createbucket PUT request results in a generic LocationConstraint error.
This is extensively covered in a python aws sdk here:
boto/boto3#125
The Amazon documentation does not correctly document this quirk, so everyone has to find it by trial and error and googling. (I've requested that Amazon fix their docs.)
http://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUT.html
In the meantime, forcing agorapulse.libs.awssdk.util.AwsClientUtil#DEFAULT_REGION to be added to PUT requests is breaking the calls to createBucket, and possibly to other api calls.
grails.plugin.awssdk.s3.AmazonS3Service#createBucket(java.lang.String, java.lang.String)
region = serviceConfig.region ?: config.region ?: AwsClientUtil.DEFAULT_REGION
The required workaround to the Amazon bug is to send no region when using 'us-east-1'.
The current version of this sdk does not support that option.
If I set the region to 'us-east-2', I can successfully create a bucket, and using a different region is the only programmatic workaround I know of for others using the grails aws sdk. (Of course, depending on your use case, you can simply create your buckets manually in us-east-1 via s3 web console.)
By using a different region, your S3 latency and costs will go up since you will have to now pay for data transfer between the default region and your workaround region.
I have not tested how much of the Amazon S3 API breaks when the default region is sent in the request. It could be a much bigger problem than just creating buckets.
Environment:
org.grails.plugins:aws-sdk-s3:2.1.9
ubuntu 14.04 LTS
java 8
grails 3.1.14
The text was updated successfully, but these errors were encountered: