Skip to main content

Setup Cloudfront

Create Cloudfront distribution.

Distribution Settings

For SSL

Set Custom SSL, using the SSL certificate you created.

Add CNAMES

example.com
www.example.com

For non-SSL

Only set example.com CNAME as www.example.com will be handled by your bucket for redirection.

Origin Settings

Put in the S3 URL given when you created S3 bucket, DO NOT USE AUTOCOMPLETE.

Behavior Settings

Set "Redirect HTTP to HTTPS" and "Compress objects automatically" option.

Setup DNS Records

Copy domain name from Cloudfront, it is the 3rd column in the table on the index page.

It should look something like dxxxxxxxxxxxxx.cloudfront.net

In Route 53

Go to your zone and create the following records:

NameTypeValue
example.com.AALIAS dxxxxxxxxxxxxx.cloudfront.net.
example.com.AAAAALIAS dxxxxxxxxxxxxx.cloudfront.net.
www.example.com.CNAMEdxxxxxxxxxxxxx.cloudfront.net.

Non-SSL notes

If you are not using SSL, you should point the www domain directly to your S3 bucket to handle redirection.