Static site in Minutes using Pulumi and Hugo
This is a submission for the Pulumi Deploy and Document Challenge: Fast Static Website Deployment pulumi): Fast Static Website Deployment* What I Built I made my little portfolio website using Pulumi and hugo. Live Demo Link portfolio website Project Repo github repo My Journey I was thinking about having a personal portfolio website for months but was just feeling lazy. I also wanted explored Pulumi for past few weeks and came across this Dev challenge and decided to give it a go. some prerequisites Hugo cli: you will be needing this to build your static site, it's fast comes with various themes to get you started quickly.It automatically creates the site structure for you so make sure to install it. Hugo Pulumi cli: you will be using this to configure and deploy the infrastructure needed for our static site on aws. pulumi-cli aws cli: you also need aws cli. because pulumi uses aws sdk to configure aws infrastructure for you and this needs your aws credentials like access key id and secret access key. aws-cli getting started Now we can proceed. Runpulumi login --local we will be using our local machine as the backend for pulumi stacks. Now Create a new directory (name of your choice) and Run pulumi newit will ask for your project name,description,config passphrase and your new stack name and will prompt you to select a template make sure to select the "static-website-aws-go" template. after setting up pulumi in this directory we will create our site in the same directory. from the same directory run below command to setup a hugo site hugo new site "your site name" now in this site (let's say your site name is Mysite hugo will create a Mysite directory ) go to content directory and add main page add main page by running touch _index.md write something in it and and run hugo server this will start hugo server and you will see your changes live on localhost::some_port link will be shown in terminal. now build your site by running hugo from the site directory and it will build all your static files in public directory. now finally...Trust me it's the last step. go to your pulumi.localStack.yaml(present in root directory ) configure it to point to your build directory that is "./Mysite/public/". after doing this run pulumi up and you will see URl to your static site. To destroy all the aws resources created use pulumi up How we used pulumi ? we used pulumi to configure these two aws resources for our static site aws s3 and cloudfront. the main.go in our root dir does all this stuff it creates and configures an s3 bucket and stores these static files from public dir from your site and then creates a cloudfront resource. okie...but how does pulumi work ?? pulumi use stacks to store the state of your infrastructure whenever you do pulumi up it deploys that particular stack state. it compares the current state of your stack with modified state and based on that it creates or destroys infrastructure resources for you. Hope this helped now go ahead and make your own static site using pulumi and hugo.

This is a submission for the Pulumi Deploy and Document Challenge: Fast Static Website Deployment
pulumi): Fast Static Website Deployment*
What I Built
I made my little portfolio website using Pulumi and hugo.
Live Demo Link
Project Repo
My Journey
I was thinking about having a personal portfolio website for months but was just feeling lazy. I also wanted explored Pulumi for past few weeks and came across this Dev challenge and decided to give it a go.
some prerequisites
- Hugo cli: you will be needing this to build your static site, it's fast comes with various themes to get you started quickly.It automatically creates the site structure for you so make sure to install it. Hugo
- Pulumi cli: you will be using this to configure and deploy the infrastructure needed for our static site on aws. pulumi-cli
- aws cli: you also need aws cli. because pulumi uses aws sdk to configure aws infrastructure for you and this needs your aws credentials like access key id and secret access key. aws-cli
getting started
Now we can proceed.
Runpulumi login --local
we will be using our local machine as the backend for pulumi stacks.
Now Create a new directory (name of your choice) and Run pulumi new
it will ask for your project name,description,config passphrase and your new stack name and will prompt you to select a template make sure to select the "static-website-aws-go" template.
after setting up pulumi in this directory we will create our site in the same directory.
from the same directory run below command to setup a hugo site
hugo new site "your site name"
now in this site (let's say your site name is Mysite hugo will create a Mysite directory ) go to content directory and add main page add main page by running touch _index.md
write something in it and and run hugo server
this will start hugo server and you will see your changes live on localhost::some_port link will be shown in terminal.
now build your site by running hugo
from the site directory and it will build all your static files in public directory.
now finally...Trust me it's the last step. go to your pulumi.localStack.yaml(present in root directory ) configure it to point to your build directory that is "./Mysite/public/".
after doing this run pulumi up
and you will see URl to your static site. To destroy all the aws resources created use pulumi up
How we used pulumi ?
we used pulumi to configure these two aws resources for our static site aws s3 and cloudfront. the main.go in our root dir does all this stuff it creates and configures an s3 bucket and stores these static files from public dir from your site and then creates a cloudfront resource.
okie...but how does pulumi work ??
pulumi use stacks to store the state of your infrastructure whenever you do pulumi up
it deploys that particular stack state. it compares the current state of your stack with modified state and based on that it creates or destroys infrastructure resources for you.
Hope this helped now go ahead and make your own static site using pulumi and hugo.