DEV Community

Discussion on: How to Host a Static Website on AWS with HTTPS and CI/CD

Collapse
 
timo_ernst profile image
Timo Ernst • Edited

If you don't have a custom domain but instead just want to get a HTTPS certificate for your AWS bucket's website endpoints follow these steps:

  1. Open the CloudFront console console.aws.amazon.com/cloudfront/
  2. Choose Create Distribution.
  3. Under Web, choose Get Started.
  4. For Origin Domain Name enter your S3 bucket's website endpoint.
  5. For Viewer Protocol Policy, choose HTTP and HTTPS (Note: Choosing HTTPS Only blocks all HTTP requests).

Instructions from: aws.amazon.com/premiumsupport/know...

To find the url to your static site, open your CloudFront distribution and you should see the domain under "Domain Name". It should look something like 123whatever.cloudfront.net.

You should now be able to access your statically hosted site on S3 bucket via https://123whatever.cloudfront.net/index.html (Replace 123whatever with the subdomain that was given to you)

Note: I noticed that you must specify the filename at the end of the url, so in this case index.html. If you don't do that you will get an error. Does anyone know how to fix this, so the site would be available via https://123whatever.cloudfront.net/index.html?