Brad Lucas

A blog mostly about programming
August 10, 2017

Cname To S3 Bucket

The url you get for a S3 hosted web site is a bit long. You might want to set up a subdomain from your domain that points to your S3 hosted site. The trick to do this involves how you name your bucket.

Here is an example.

Suppose your domain is mydomain.com and you want to setup a subdomain myapp.mydomain.com which points to a S3 hosted website.

To make this work the key is to create a bucket called myapp.mydomain.com. This will give you a endpoint of http://myapp.mydomain.com.s3-website-us-west-2.amazonaws.com.

Now, when you setup your CNAME record have your myapp.mydomain.com name point to myapp.mydomain.com.s3-website-us-west-2.amazonaws.com.


Tags: aws s3