Contact us now for a free tech consultation +5492235066274

Using SSL with S3 + CloudFront

At XOOR we find ourselves building static websites for customers very frequently. It doesn’t matter how we implement this websites, they can be either Angular 2, React or just plain old HTML+CSS+JS. The important thing they all have in common, is that these websites are fully static. They might have a contact form, but we usually build these using an Amazon Lambda (that story is for another post).

Hosting a static website on a web server it’s quite expensive if you think you’re just serving static files. Using a static file server instead of a web server is a good ‘n cheap alternative and that’s what we’ll cover in this post.

Let’s do a quick summary of the steps we’ll follow to achieve the final goal: have a static website hosted on Amazon S3, distribute the website on multiple locations using Amazon CloudFront, serve the website securely through HTTPS and finally use a custom domain name to access it:

  1. Create and configure the S3 bucket
  2. Create an SSL certificate
  3. Create and configure CloudFront
  4. Configure Route53 to use our custom domain name
  5. Done!

To make things short I’ll assume you already have an AWS account ready to be used and have a little (tiny little) understanding of what the services we’re going to use are.

Create and configure the S3 buckets

The first task we have is to create the bucket where our static website will be residing. For the purpose of this post, I’ll use as my custom domain. I assume you already have a domain name of your own that you’ll use to load your static website.