Search code examples
sslhttpsamazon-s3amazon-cloudfront

HTTPS for Amazon S3 static website


I want to host a HTTPS-only static website using Amazon S3 and CloudFront. Here's what I've done so far:

  1. Set up an S3 bucket for static website hosting and put my website files in it
  2. Created a CloudFront distribution and pointed it to the S3 bucket
  3. Added a CNAME record in my domain's nameservers for the www subdomain pointing to the CloudFront bucket.

So far, so good - I can access my website using the www.example.com address. However, I want the site to be available via HTTPS only, for which I bought an SSL certificate from GoDaddy.

Now, the question is:

  1. Is there a way to install this third-party SSL certificate on my S3-hosted website?
  2. Is there a way to have an automatic http to https redirect with this setup?

Solution

  • Yes, as of today you can do it at no charge.

    You can now use HTTPS with CNAMEs on CloudFront as it now supports custom SSL certificates using Server Name Indication (SNI): http://aws.typepad.com/aws/2014/03/server-name-indication-sni-and-http-redirection-for-amazon-cloudfront.html

    I managed to set up a free Class 1 StartSSL cert for my CloudFront distributed static site on S3 without too much trouble (see: CloudFront error when serving over HTTPS using SNI).