Deploy Hugo static websites to AWS
Project description
CDK-Hugo-Deploy
This is an AWS CDK Construct for easily deploying Hugo Static websites to AWS S3 behind SSL/Cloudfront.
Usage
Before deploying, run the hugo
command in your Hugo project to generate a built site in the public
directory.
Typescript
import { App, Stack, StackProps } from 'aws-cdk-lib';
import { HugoDeploy } from 'cdk-hugo-deploy';
export class MyStack extends Stack {
constructor(scope: Construct, id: string, props?: StackProps) {
super(scope, id, props);
new HugoDeploy(this, 'HugoDeploy', {
publicDir: 'path/to/hugo-project/public',
domainName: 'example.com' // Domain you already have a hosted zone for
});
}
Python
from constructs import Construct
from aws_cdk import Stack
from cdk_hugo_deploy import HugoDeploy
class MyStack(Stack):
def __init__(self, scope: Construct, id: str, **kwargs):
super().__init__(scope, id, **kwargs)
HugoDeploy(self, "HugoDeploy",
public_dir="path/to/hugo-project/public",
domain_name="example.com"
)
Prerequisites
Assumes that there is already a Route53 hosted zone for domainName
that can be looked up
Why this construct?
Other constructs for deploying Single Page Applicationis (SPA) such as CDK-SPA-Deploy don't account for how Hugo handles paths that end in /
.
This construct includes a Cloudfront Function to rewrite paths to ensure /path/to/page/
will request /path/to/page/index.html
from the S3 Origin.
Contributing
Please open an issue with any updates/features you'd like on this
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for cdk_hugo_deploy-0.0.417-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 40dabcb1f4c9d2a663bd92ea5a5da2e4d3d70d7165214cc5287ceaa69a23ffc6 |
|
MD5 | 2fe8a62482e2d70c14f3094756b114a7 |
|
BLAKE2b-256 | 87f5abf1a35bac3bab85762fe9b7080f5f642b5cf2ae52d377990c5d60c47f06 |