Netlify, Github and Cloudflare all offer generous free tiers which you can use for your static web hosting needs. This post describes the experience of moving hosts from S3 to Netlify.


Five years ago I migrated from Wordpress to Jekyll where Jekyll would generate this (now heavily modified) static site and I’d deploy it to S3. S3 now presents an issue for me where it doesn’t support https without Cloudfront, but my CDN of choice is Cloudflare. Because of this I can’t use Cloudflare’s Full SSL/TLS mode, and I’ve hit redirect loop errors using Flexible.

Migrating from S3 to Netlify

After creating a free account on Netlify, I drag and dropped a local copy of my Jekyll output and Netlify created the site for me. I use Cloudflare as my domain registrar, and I could immediately point the CNAME for my apex domain to site URL Netlify provided. Adding the domain to the site in Netlify then auto-generated a LetsEncrypt certificate. Too easy.

Deploying with Github Actions

Previously I was using Azure DevOps to deploy to S3, but I wanted to move to Github Actions for this particular deployment. The first two steps after checkout below are straight from the previous pipeline. I like docker because it easily lets me move existing functionality elsewhere. The first step generates social media images for posts and the second generates the rest of the blog.

# .github/workflows/netlify.yml
name: Build and Deploy to Netlify
      - master
    runs-on: ubuntu-18.04
      - uses: actions/checkout@v2
        name: Checkout
      - run: docker run -v ${GITHUB_WORKSPACE}:/o staff0rd/image-generator:1.0.1 /o/_posts /o/_assets/post-background.png /o/_assets/Roboto-Regular.ttf /o/assets/cards
        name: Generate cards
      - run: docker run -e TZ=Australia/Sydney -v ${GITHUB_WORKSPACE}:/srv/jekyll -v ${GITHUB_WORKSPACE}/_site:/srv/jekyll/_site jekyll/builder:3 -- jekyll build --future --trace
        name: Generate site
      - uses: jsmrcaga/action-netlify-deploy@v1.1.0
        name: Deploy to Netlify
          NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
          NETLIFY_DEPLOY_TO_PROD: true
          build_directory: _site
          NETLIFY_DEPLOY_MESSAGE: "Deployed commit ${{ github.sha }}"

Optimised for Speed

The third step deploys the output from the previous steps using Netlify Deploy. A nice feature of this task is that it appears to diff the source and destination files and only copy the changes. Previously I was using S3 Upload which was taking up to 7 minutes just to deploy. This new task takes about a minute and Netlify sorts out cache invalidation.


Importantly I can now set Cloudflare to use Full TLS as there’s a certificate on the host. Moving from S3 was both quick to do, and resulted in faster deployment pipeline.