How to make your AWS S3 objects accessible through your own domain name

How to make your AWS S3 objects accessible through your own domain name.
What is an AWS S3 bucket?  Most of you already know or you would not be reading this posting but, very generally, it is very cost effective Amazon Cloud based storage that stands alone (no cloud host required on our end).
Set up an S3 bucket with a hostname of your choice and your Route 53 supported domain name.
For example create a S3 bucket named:
resume.mydomain.com
“resume” is a hostname of your choosing – anything you want.
“mydomain.com” is a domain you have registered with and use AWS Route 53 for your DNS Services / Records – AWS calls these “hosted zones”
Yes, to do this the domain you use must be registered with and DNS services supported thru AWS Route 53.
Creating the AWS S3 Bucket
How do you actually create the S3 bucket?  Goto S3 in the AWS Console, choose Create Bucket and follow the prompts.  Same goes for uploading files.  It is all very very straight forward in the AWS Console / Browser of your choice.
The S3 bucket you create must have exactly the same <hostname.domain> that you want in your URL. Grant public read on the bucket and grant public read on any files/object keys you want in your URL.  How do you grant public read?  Highlight the object and select the “permissions” tab.
So in this example – I granted public read on the S3 bucket resume.mydomain.com and public read on the S3 file/object/key name – index.html.
Create a AWS Route 53 CNAME record that matches your S3 bucket name
Now create a CNAME record with Route 53 that will look something like this.

Name                 Type  Value
resume.mydomain.com. CNAME resume.mydomain.com.s3-us-west-1.amazonaws.com.

How do you know what the CNAME Value should be? Good question – goto AWS S3
Select a file in the S3 bucket you want to use – and select the “Overview” tab – that tab will show a URL / link at the bottom – use a modified version of that “link” to create the CNAME record.
For example if the S3 Object URL link were as follows.
Link
https://s3-us-west-1.amazonaws.com/resume.mydomain.com/index.html
Resulting CNAME record again would be:

Name                 Type  Value
resume.mydomain.com. CNAME resume.mydomain.com.s3-us-west-1.amazonaws.com.

Notice that all I did was rearrange the URL link components a little to come up with the CNAME?  Also, obviously the “index.html” filename does not go in the CNAME Value.
Testing
To test – you may have wait a little while for the CNAME record to propogate thru the internet.  But after a while a URL of the form:

http://resume.mydomain.com/index.html

Will work.

Leave a Comment

Scroll to Top