Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom domain for s3 bucket?

Tags:

amazon-s3

I have S3 bucket called "mybucket". Files from there are available under following links:

  1. mybucket.s3.amazonaws.com/path/to/file.jpg
  2. s3.amazonaws.com/mybucket/path/to/file.jpg

I need custom domain for files served from s3. I added DNS CNAME record pointing to from images.mydomain.com to s3.amazonaws.com (also tried images.mydomain.com -> mybucket.s3.amazonaws.com).

In both cases when I try to GET images.mydomain.com/mybucket/path/to/file/jpg (or images.mydomain.com/path/to/file.jpg) I get S3 error like

Bucket 'images.mydomain.com' does not exist

Is there any workaround for this or I have to change bucket name to images.mydomain.com?

like image 440
user606521 Avatar asked Sep 04 '14 13:09

user606521


People also ask

What is the URL of my S3 bucket?

An S3 bucket can be accessed through its URL. The URL format of a bucket is either of two options: http://s3.amazonaws.com/[bucket_name]/ http://[bucket_name].s3.amazonaws.com/


1 Answers

You need to change the bucket name. The virtual hosting docs specifically say (in the "Customizing Amazon S3 URLs with CNAMEs" section)

The bucket name must be the same as the CNAME

like image 141
Frederick Cheung Avatar answered Sep 18 '22 18:09

Frederick Cheung