By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement . We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OS version : OSX

Describe the feature :

When we using us-east-1 , s3 plugin will first get the endpoint by using the region , and then use the endpoint to create the client, this is fine.

But when creating the bucket, s3 plugin will will the bucket name to build a CreateBucketRequest ( link ), us-east-1 is not valid for aws s3 sdk.

Reproduce:

PUT _snapshot/test-1
  "type": "s3",
  "settings": {
    "bucket": "test-us-east-1",
    "region": "us-east-1"
   "error": {
      "root_cause": [
            "type": "repository_exception",
            "reason": "[test-6] failed to create repository"
      "type": "repository_exception",
      "reason": "[test-6] failed to create repository",
      "caused_by": {
         "type": "creation_exception",
         "reason": "Guice creation errors:\n\n1) Error injecting constructor, com.amazonaws.services.s3.model.AmazonS3Exception: The specified location-constraint is not valid (Service: Amazon S3; Status Code: 400; Error Code: InvalidLocationConstraint; Request ID: 85CFF34E01878232), S3 Extended Request ID: Ob5XZJsy8IH7HaZy/moMNAgvaH3ZIrHN9fxyimecIp+xtMZI8nE/sc2YVIoTuf2SuEXyoiQP1wE=\n  at org.elasticsearch.repositories.s3.S3Repository.<init>(Unknown Source)\n  while locating org.elasticsearch.repositories.s3.S3Repository\n  while locating org.elasticsearch.repositories.Repository\n\n1 error",
         "caused_by": {
            "type": "amazon_s3_exception",
            "reason": "The specified location-constraint is not valid (Service: Amazon S3; Status Code: 400; Error Code: InvalidLocationConstraint; Request ID: 85CFF34E01878232)"
   "status": 500

Succeed after removed the region

PUT _snapshot/test-1
  "type": "s3",
  "settings": {
    "bucket": "test-us-east-1"

Same thing happened if we used us-west | ap-southeast | eu-central...
I think if we could get the endpoint, we should using the valid region name and let user be able to create buckets.

As per http://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUT.html: "If you are creating a bucket on the US East (N. Virginia) region (us-east-1), you do not need to specify the location constraint".

Other regions work fine. I can take this up.

jprivillaso, github-armin, choww, salmanbabri, kethansrinivas9, eduhrcastro, Scusemua, and evantilley reacted with thumbs up emoji Lis2T and maxisme-paradime reacted with confused emoji All reactions

Knowing that we deprecated region in #22848 and removed it in #22853, I think we should close this issue as it won't be fixed.

@clintongormley WDYT?