Elasticsearch: 'us-east-1` is not a valid region when creating s3 bucket

Created on 7 Mar 2016  路  5Comments  路  Source: elastic/elasticsearch

Elasticsearch version: master

JVM version: 1.8

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.

:DistributeSnapshoRestore >bug good first issue help wanted

Most helpful comment

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.

All 5 comments

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.

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?

This issue wasn't even about region really, it was about auto bucket creation (failing because of specifying region). Since auto bucket creation is now gone, we can close.

Thanks @rjernst

@dadoonet and @rjernst thanks.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

abrahamduran picture abrahamduran  路  3Comments

DhairyashilBhosale picture DhairyashilBhosale  路  3Comments

martijnvg picture martijnvg  路  3Comments

matthughes picture matthughes  路  3Comments

clintongormley picture clintongormley  路  3Comments