TechRemarker
TechRemarker

Reputation: 2938

Custom Domain for S3 Files

This should be easy as there is no shortage of pages on custom domains and S3 but for some reason I can't seem to get it to work as expected.

I have a S3 Bucket full of videos. The S3 bucket is called for example "videos.foo.com". I bought the domain "videos.foo.com" and set it up in cloudflare with the cname "videos.foo.com" pointing to "videos.foo.com.s3-website-us-east-1.amazonaws.com".

I can view files in my bucket by going to there full url such as "videos.foo.com.s3-website-us-east-1.amazonaws.com/myvideo.mpg".

My problem is I can't view them by going to "videos.foo.com/myvideo.mpg".

I tried enabling "Redirect all requests to another host name" and entering "videos.foo.com" but that didn't work either. To note, I will 'not' be hosting a site at "videos.foo.com" just serving files.

All the files have permissions everyone: open/download.

If anything sees the error in my ways please let me know. In the mean time I'll keep searching and going through trial and error. Thanks!

Upvotes: 3

Views: 2500

Answers (2)

Anatoly
Anatoly

Reputation: 15530

Nginx S3 proxy helps to solve that problem, please check more details: https://stackoverflow.com/a/44749584/290338

A bucket can be named differently, the only performance rule is to have EC2 and a bucket in the same geo location.

Upvotes: 1

David Fevre
David Fevre

Reputation: 884

You may need to configure the Route 53 record as an alias rather than a cname. In R53, edit your record set and configure it like this -

Type: A - IPv4 address
Alias: Yes

When you click in the Alias Target textbox it will drop down a list that contains your S3 bucket (if it's properly configured). It can take a while to load that list so be patient. Select your bucket and hit save.

Check out this document for more info - http://docs.aws.amazon.com/AmazonS3/latest/dev/website-hosting-custom-domain-walkthrough.html

Upvotes: 0

Related Questions