Hosting a Static Site on S3 with Cloudfront

Process for creating a static site using AWS Cloudfront

It feels like it took a while to get here but Influential Code LLC is official. Our goal is to provide as much value as we can to our clients and readers can. To do that, we aim to create posts that will be short and direct explanations of something that can benefit the audience. Most likely that will be something that we’ve done or something that interests us as well.

For this first post, I’ll begin with the site that you’re viewing right now. How did we make it? Why did we choose to do what we did?

How

All of the HTML is generated by Jekyll, a tool to help you create, among other things, an easy to use blog from text files. There’s nothing wrong with WordPress or other database-based CMS but it was more important to have flexibility now so that the site can more easily be migrated to something else later, if needed. Extracting from a database and migrating the content can be challenging so creating text files using Markdown seemed much easier.

The site itself is “hosted” on AWS. I say “hosted” because the HTML files generated by Jekyll are hosted in an S3 bucket; there isn’t a web server running in a container or on an EC2 instance. To help encourage new posts, the raw files are version controlled in Bitbucket and Pipelines automates the generation of the pages and deployment to an S3 bucket. From there, Cloudfront serves content to users across the globe.

Why

Maintaining servers, even in the cloud, is work. Ensuring that they’re healthy and patched and that the site is highly available is time away from what we enjoy. It also costs money, which is something we prefer not to spend much of right now. Instead, we’re relying on the durability, availability, and cost of S3. We also chose not to deploy our own Jenkins server and instead rely on Pipelines. They provide 50 minutes a month of build time and that is more than enough to generate and deploy our site. How we feel about maintaining our own web servers applies to CI/CD servers as well.

Getting Started

If you’d like more information or would like to try something similar yourself, Amazon offers a tutorial that can help you get started. If you need further help, please consider contacting us and learning more about consulting services we can offer for this or other projects.