hosting hugo created site on AWS amplify
By JIMz
overview
the hugo official guidelines regarding hosting on AWS amplify is slightly confusing or unclear at best, and some additional notes are given below.
additional note to step 3 in the section “Hosting”
The very tiny and unclear screen capture attached there shows baseDirectory: /public
, which never occur in the apps I just built yesterday ( 2024-11-30 ), none of them carry that so-called “detection”, which means you must add that yourself.
I also tried propose this change to the official doc with a pull request, but it wasn’t welcomed ( ¯\_(ツ)_/¯ ), so i’ll keep this note here instead ~
specify the param baseDirectory
there are 2 ways :
1. inside the AWS Amplify web dashboard
on the left column :
- choose “Hosting > Build Settings” ;
- edit the file
amplify.yml
; - add
/public
tobaseDirectory
;
2. add a file in your repo to override the web dashboard config
or you may add a file named amplify.yml
in the root of your repo to override the build settings in Amplify.
the updated build setting / amplify.yml
the modified amplify.yml
for hosting hugo ( with baseDirectory
modifed ) looks like this :
version: 1
frontend:
phases:
# IMPORTANT - Please verify your build commands
build:
commands: []
artifacts:
# IMPORTANT - Please verify your build output directory
baseDirectory: /public
files:
- '**/*'
cache:
paths: []