6

I'm just setting up a simple splash page basic static HTML and I decided to put it on S3.

my bucket name is called the same as my domain

www.example.com.s3-website.eu-west-2.amazonaws.com/

And then I've got a CNAME set to the same thing.

the only problem is i'm getting a 400 error from Amazon S3

400 Bad Request

  Code: IncorrectEndpoint
  Message: The specified bucket exists in another region. Please direct 
  requests to the specified endpoint.

I've checked and my bucket is definitely EU West and this is the endpoint it's given me when serving a static site.

Karl Taylor
  • 4,839
  • 3
  • 34
  • 62
  • Go into the S3 bucket properties, click on Static website hosting. It will give you the URL to use. Check that it is working, then check that your CNAME points to the same URL. – John Rotenstein Jun 18 '17 at 12:54
  • We're going to need the actual name of the bucket in order to troubleshoot the less-obvious details. – Michael - sqlbot Jun 18 '17 at 14:14

2 Answers2

2

You can check your bucket location through the following command.

aws s3api get-bucket-location --bucket {bucketname}

Could it be, that your bucket is located in eu-west-1 instead of eu-west-2?

jens walter
  • 13,269
  • 2
  • 56
  • 54
  • Came back with { "LocationConstraint": "eu-west-2" }, and going to www.example.com.s3-website.eu-west-1.amazonaws.com is 404. It's definitely there, it's just not directing correctly and I'm so confused as to why. – Karl Taylor Jun 18 '17 at 12:46
2

I didn't manage to solve the wrong region problem, however, I created a cloudfront distrubution and set a CNAME to that instead.

Karl Taylor
  • 4,839
  • 3
  • 34
  • 62