AWS Lambda function for updating a Hugo blog hosted in S3/CloudFront
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


This Go code is meant to be run in AWS Lambda and is what I use to update my blog, the source of which is stored on GitHub and hosted in S3 and CloudFront.


  1. Download the 64-bit Linux version of hugo from here:
  2. Put the hugo binary in the same directory as this repository
  3. Create the AWS Lambda bundle: GOOS=linux go build main.go && zip main hugo
  4. This will create which is your Lambda function.

When you create you Lambda function, pick a decent function timeout and memory usage. I use a 1 Minute timeout and 512MB function memory and it works for me. YYMV.

Environment variables to set

Env Var Description example
GIT_REPO The URL for the Git repository that hosts your Hugo blog
S3_BUCKET The S3 bucket that hosts your blog
S3_REGION The AWS region your S3 bucket lives in us-east-1
CLOUDFRONT_DISTRO (Optional) The CloudFront that should invalidated on update E3W5ET0Z9WW0IT