Refactoring DLTJ, Winter 2021 Part 2: Adopt AWS Amplify
Look at that!
Progress is being made down the list of to-dos for this blog in order to start the new year on a fresh footing.
As you might recall from the last blog post, I set out to do some upgrades across the calendar year boundary:
Ramp up automation for adding reading sources to Obsidian
Refactor the process of building this static website on AWS (this post)
Recreate the ability for readers to get updates by email
Turn the old DLTJ “Thursday Threads” concept into a newsletter
DLTJ is a «static site» blog, meaning that the page you are reading right now is a straight-up HTML file.
This page is converted from the simple
Markdown format
to HTML by the
Jekyll
program.
The DLTJ blog used to be based on WordPress, which meant a server was always running to dynamically generate each webpage out of a database.
(If you go back in the DLTJ archives you’ll see notes on top of pages that were part of the automatic conversion from WordPress to Markdown.)
That WordPress server was quite costly to have constantly run for a small blog.
(Yes, it is possible to pay someone a small amount to host your WordPress blog for you, but I’m a do-it-yourself kind of person.)
So
at the end of 2017 I migrated the site
to
Markdown stored in a GitHub repository
with the Jekyll conversion and content delivery through Amazon Web Services (AWS).
Serving up static web pages from AWS S3/CloudFront is really simple.
Processing the Markdown on GitHub into HTML via Jekyll on AWS is more complicated, and that process was something that I wanted to happen automatically every time I published a change to GitHub.
I ended up hand-crafting about 650 lines of an AWS CloudFormation configuration file plus a few dozen lines of Python in some AWS Lambda functions.
It worked, but it was fragile and very hard to maintain.
That was in 2017 and technology marches on; now AWS has a service that does all of the automation for you.
Called
Amplify
, it bundles together a bunch of other AWS tools to help developers to create «full-stack web and mobile apps.»
The Amplify tools are really quite overkill for a static website, but
building a static website
is one of the hands-on «Getting Started» examples that AWS offers.
For a static website, Amplify handles:
creating an S3 bucket and CloudFront distribution to store and serve up the content
provisioning a webhook API that notifies AWS to start the content building process and adds that webhook to the GitHub repository
setting up the CodeBuild process for Jekyll to generate the static web pages
creating the HTTPS security certificate and adding the appropriate DNS entries to the domain
All of the stuff I was doing in that 650-line CloudFormation file.
(Plus Amplify has a lot more interesting features built into the service.)
AWS Amplify Console
One Problem: Getting the Correct Version of Ruby
Now for the two-hour detour.
At least one of the Jekyll Gems I’m using to build th…
Descubre más desde Hoy En Perspectiva
Suscríbete y recibe las últimas entradas en tu correo electrónico.