That Was Easy: Hugo Deploy + AWS S3

Well, that didn’t take long.

So earlier, I mentioned trying to make the deployment workflow easier.

Yeah, Hugo already did that.

The steps go:

  1. install the AWS CLI
  2. Do aws configure with your bucket details, locally.
  3. follow the steps to setup. Here’s what I had to do in my config.yaml
    • order: [".jpg$","$.gif$"]
      targets:
        - name: "aws"
          URL: s3://www.devharryc.com?region=us-east-1
      matchers:
        - pattern: "^.+\\.(js|css|svg|ttf)$"
          cacheControl: "max-age=31536000, no-transform, public"
          gzip: true
        - pattern: "^.+\\.(png|jpg)$"
          cacheControl: "max-age=31536000, no-transform, public"
          gzip: false
        - pattern: "^.+\\.(html|xml|json)$"
          gzip: true
      
  4. do hugo deploy

Hugo Deploy takes care of doing a smart diff/deploy so you don’t breach yours S3 free tier.