Last time, we used CDK to host a static website in AWS. Today we’re going to look at adding a static site generator to our pipeline so that we don’t have to create all of our pages by hand.
We’ve found the Hugo static site generator to be simple and effective, so we’ll use it for this example, but the steps should apply to any similar tool.
First, we’ll need a buildspec. This needs an install phase to set up the generator
tool in the pipeline runner, and a build phase to execute it. It serves no practical
purpose to upload the source files to S3, so we’ll only export the generated assets
as artifacts. With Hugo, this will be the contents of the public/
directory.