My goal is to setup a custom url, in this case static.ironcodestudio.com, to pull directly from an S3 bucket.
Create the Bucket
Create the bucket with the name matching the url where you’ll load the file. In my case, I named the bucket static.ironcodestudio.com
For the Region, I recommend US Standard.
Make the Bucket Publicly Accessible
Go to the bucket Properties and choose Static Website Hosting.
Select Enable website hosting
Set Index Document to index.html
Set Error Document to index.html
Take note of the endpoint, in my case it is static.ironcodestudio.com.s3-website-us-east-1.amazonaws.com
Upload the Files
Upload an index.html
file to display if a matching file is not found. You can view the source of my file at
view-source:http://static.ironcodestudio.com.s3-website-us-east-1.amazonaws.com/
and make the file public.
Setup the Custom URL
Remember, the custom URL should match the S3 bucket name.
Within your DNS settings on your name server, create a CNAME for your custom url static.ironcodestudio.com
that points to the endpoint you record above static.ironcodestudio.com.s3-website-us-east-1.amazonaws.com
You’ll need to give time for the DNS to propagate but then going to your custom url static.ironcodestudio.com
should display the index.html
file you created.
Additional Files
When uploading additional files, remember to make them public as well.
photo credit: peasap via photopin cc
Leave a Reply