Skip to content

angelbarrera92/hugo-static-web-site-in-s3

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hugo static site on AWS S3

Hugo is a fast and modern static site generator written in Go, and designed to make website creation fun again.

Amazon Simple Storage Service (Amazon S3) is an object storage service that offers industry-leading scalability, data availability, security, and performance.

TL;DR;

$ duffle install hello-cnab -c aws-s3-creds -f ./bundle.cnab

Introduction

This CNAB bundle bootstraps a static website deploying it on an AWS S3 Bucket.

Under the hood, this package provisions the website using the awscli rendering the site using Hugo.

See it in action in the following video:

Demo

Prerequisites

  • AWS account with permissions to provision S3 buckets.

Installing the CNAB Bundle

Important: The bundle is not recommended for production purposes.

In order to manage the bundle, we are going to use a command line tool called Duffle, please ensure that you have installed its latest version before continue.

Clone this repository

Clone this repository to download the bundle and the verification key to your filesystem:

$ git clone --recurse-submodules git@github.com:angelbarrera92/hugo-static-web-site-in-s3.git
$ cd ./hugo-static-web-site-in-s3.git

Import Signing Key

CNAB bundles, by default, are signed by their provider and importing a verification key is required to verify the integrity and source of the package.

Tip: Alternatively you can append the --insecure flag to every duffle command

# verification-public.key can be found in the git repo, download it and then run:
$ duffle key add verification-public.key --armored

Verify signature

To verify the bundle, just type:

$ duffle bundle verify -f ./bundle.cnab
Signed by "Angel Barrera Sanchez <angelbarrerasanchez@protonmail.com>" (5A81 FE7A A779 DE57 55EA AFAE 3512 FAD7 7C6A 475)

Define Credentials

Some credentials from your environment need to be supplied to the bundle. Specifically, AWS credentials are required to manage the S3 Buckets.

First, generate a credentials file:

$ duffle creds generate aws-s3-creds -f ./bundle.cnab

This will create a file in ~/.duffle/credentials/aws-s3-creds.yaml showing the credentials needed with empty values.

You can either fill the values in directly, or edit them by typing:

$ duffle creds edit aws-s3-creds

Parameters

The following table lists the configurable parameters of the Hugo statis website in S3 CNAB bundle and their default values.

Parameter Description Default
aws-default-region Specifies the AWS region to send the request to. eu-central-1

Usage Examples

Installation with default settings, will create a bucket in eu-central-1 region:

$ duffle install my-release -c aws-s3-creds -f ./bundle.cnab

Installation with specific region:

$ duffle install my-release -c aws-s3-creds --set aws-default-region=us-east-1 -f ./bundle.cnab

You can also uninstall a release

$ duffle uninstall my-release -c aws-s3-creds

Development

# Build a new version of the bundle
$ duffle build .
# Export the generated bundle
$ duffle show hugo-static-web-site-in-s3:1.0.0 --raw > ./bundle.cnab

About

CNAB Bundle - Hugo static web site deployed in S3

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published