When you deploy a Hugo framework on AWS Amplify, by default an old version of Hugo is used. I prefer to work with the latest version, but also to control the exact version to work with on my workstation and on production. That’s why I created a custom deployment script you can find below. Just put it in the root of your application repository.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
version: 0.1
frontend:
  phases:
    build:
      commands:
        - wget --quiet https://github.com/gohugoio/hugo/releases/download/v0.62.0/hugo_extended_0.62.0_Linux-64bit.tar.gz
        - tar -xf hugo_extended_0.62.0_Linux-64bit.tar.gz hugo
        - mv hugo /usr/bin/hugo
        - rm -rf hugo_extended_0.62.0_Linux-64bit.tar.gz
        - which hugo
        - hugo version
        - hugo -b "https://hitthecloudrunning.com/"
  artifacts:
    baseDirectory: /public/
    files:
      - '**/*'
  cache:
    paths: []

Either it’s not possible, or I haven’t found the solution for using variables throughout the build script. As far as I know it’s also not possible to retrieve the domain name for your website to use the same build script for your staging and live websites. If you can help me, please let me know! I’ll update this blog post asap.

-Martijn

Photo by Kai Oberhäuser on Unsplash.

Author
Martijn van Dongen
Cloud Evangelist / MCE
Martijn works at Schuberg Philis as Cloud Evangelist and Mission Critical Engineer (MCE). Martijn is an active AWS developer, architect, consultant, and trainer. He is chair of AWSug.nl and recognized as an AWS Community Hero.
View more
Next Blog
blog
The Dutch AWS User Group NL organized 29 meetups in 2019 - a review
January 9, 2020 | Est. read time: 3 minutes
Last year we organized 29 meetups ourselves and co-organized 40+ events with other sponsors and at commercial and community events. Here are some highlights and numbers.
Read
Tags
Hugo Amplify