AWS Amplify is a “development platform for building secure, scalable mobile and web application” but it can also be used to host a static site, like this blog. This blog uses Amplify to build the static site and then push these changes to Cloudfront. Internally Amplify uses CodeBuild, Amazon’s CI/CD platform, to build the site. CodeBuild uses
buildspec.yml to decide what to build and how to build.
Amplify charges around $0.01 per minute for build time, and this blog takes around 3-4 minutes to build. So everytime I make a change I am charged around $0.04, while this might not seem a lot over a year it can seriously add up!
This is where the
cache section of the
buildspec.yml file comes in. Amplify can remember all the gems you installed, and then later builds can use it.
This post will show you how to implement Jekyll caching on AWS Amplify:
The main points are to use
bundle install --path vendor/bundle to point Bundle where to install gems and
- 'vendor/**/*' in the
Here are before and after images: