Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Code: NoSuchBucket

Tags:

So I've followed the instructions in this excellent guide for setting up a redirect from sub.my-domain.com to my-domain.com/sub. I've checked and double checked my settings, but when I access sub.my-domain.com I get the error

404 Not Found

Code: NoSuchBucket
Message: The specified bucket does not exist
BucketName: sub.my-domain.com

If I go to sub.s3-website-eu-west-1.amazonaws.com (the bucket I created) it is redirected correctly, and I am 100% certain double-plus confirmed that the url in the CNAME Record Set is the correct one. What is going on?

It seems like BucketName in the error message is wrong, but why is this?

like image 804
fredley Avatar asked Jan 24 '14 14:01

fredley


People also ask

How do I fix AWS 404 error?

If the requested object was available in the S3 bucket for some time and you receive a 404 NoSuchKey error again, then check the following: Confirm that the request matches the object name exactly, including the capitalization of the object name. Requests for S3 objects are case sensitive.

What does the specified key does not exist mean?

it simply means that your file does not exist up within the S3 bucket. Several things could be wrong: You could be trying to reference the wrong file. Double check the path that you tried to retrieve. Whenever the file was uploaded it must have failed.

How do I rename a S3 bucket?

Unfortunately, there is no easy way to rename a bucket. The only possibility is to create a new bucket with the name you want and copy the contents of an old bucket to a new one.

What does S3 Getobject return?

PDF. Retrieves objects from Amazon S3. To use GET , you must have READ access to the object. If you grant READ access to the anonymous user, you can return the object without using an authorization header.


2 Answers

It's hard to tell since you (sensibly) obfuscated your question but the way you've written it, I think this is a case of not naming the bucket correctly for this application.

sub.s3-website-eu-west-1.amazonaws.com 

If the web site is "sub.example.com," then that's not the correct convention, so I wonder if your bucket name is also not correct: the bucket should be named "sub.example.com" -- not "sub" -- and the web site endpoint should be sub.example.com.s3-website-eu-west-1.amazonaws.com.

like image 57
Michael - sqlbot Avatar answered Sep 20 '22 00:09

Michael - sqlbot


You can fix it by renaming your bucket as "Michael - sqlbot" says.

But if you really want to keep your bucket name, then you can use CloudFront to forward requests to your existing bucket, and then use DNS to map the website name(s) to the CloudFront name.

CloudFront is another Amazon Web Service that caches HTTP requests to your bucket in caches all around the world, so your website will be faster :-). But you will have to pay more :-(.

like image 22
Adam Gawne-Cain Avatar answered Sep 22 '22 00:09

Adam Gawne-Cain