How to use https with S3 (Alternate Domain Names) and Cloudfront

0

Hi,

I have an s3 static site that works but I wanted to use https, so I got the certificate (everything is done in AWS), created a cloudfront distribution, and created a DNS AAAA record set per the AWS docs, since the cloudfront distribution is IPv6. My "Not Secure" site still works fine and when I go to the cloudfront domain, the site comes up, beautifully secure, however, my domain name isn't the custom domain that I want. I have alternate domain names configured in my cloudfront configuration, yet if I try to go to https://my-custom-domain.com the site is never served.

Here are the two:
Not secure, but has right domain name:
http://inner-path.com

Secure, cloudfront but doesn't have the domain name:
https://d1sdrftx0tr9uu.cloudfront.net/intro

Thanks for looking at this. I'm sure I've just missed a step somewhere.

EDIT: I have my alternate domain names in the cloudfront distribution as:
blog.inner-path.com
www.inner-path.com
inner-path.com
*.inner-path.com

Edited by: Kapunahele Wong on Nov 7, 2019 1:01 PM

asked 4 years ago285 views
1 Answer
0

Ok, I figured this out. My certificate, cloudfront, and route53 are set up correctly, so this is what I had to fix:

  1. Your s3 bucket name cannot have a dot or period in it. That is, example.com won't work, so you'd name it example-com
  2. Your s3 bucket should not be set up to host websites. This is because it's the origin for cloudfront. Cloudfront is the website, not your s3 bucket. (Then in Route53, make sure you have an alias (A) record pointing to the cloudfront distribution.)

You can't rename a bucket so I created a new one with the right naming convention. I haven't figured out the subdomain, but that part is secondary and is going to be moved into the main domain.

Hope this helps someone. It's not documented as a straightforward workflow in the aws docs, rather as notes. If anyone from the AWS docs team sees this, please let my post be a vote for docs specifically on this workflow.

If those who work on this AWS functionality see this, it'd be so cool if setting up https for static sites using s3 were simplified. Thank you!

answered 4 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions