Why Cloud9

I needed an IDE that I could access anywhere and on any device. After some searching, I found that Cloud9 fit the bill perfectly. By using a t2.micro EC2 instance, there is no cost (at least for the first year) as long as I avoid any snapshots or unforeseen circumstances.

My ultimate goal is to host this blog using the Hugo PaperMod theme on CloudFront. In this post, I will guide you through the process of setting up your Cloud9 environment and installing both Hugo and the PaperMod theme.

Disclaimer

Before starting a project like this, there are a few things to keep in mind. Firstly, make sure to follow best practices and prioritize security (I plan to write a post on basic practices soon). Additionally, it’s assumed that you have a basic understanding of navigating both the AWS Console and the CLI.

Cloud9 Setup

To begin, navigate to Cloud9 in the AWS console and select “Create environment.” I chose the default settings for everything, including a t2.micro instance, Amazon Linux 2 OS, and SSM as the connection method.

Most of the needed artifacts (and more) are already installed on the Cloud9 EC2 instance. You can verify with the following commands from your Cloud9/EC2 instance terminal:

git --version
go version
aws --version

You probably already noticed that you automatially login as your current IAM User, meaning you have AWS permissions associated with this user.

Install Hugo

go install github.com/gohugoio/hugo@latest

Update the PATH environment variable by running (Yes, nano is already installed on Amazon Linux 2):

sudo nano ~/.bashrc

Add this line to the end of the ~/.bashrc file:

export PATH=$PATH:~/go/bin

By adding ~/go/bin to the $PATH, any executable files in the ~/go/bin directory can be executed by entering their name in the terminal, regardless of the current working directory.

Install PaperMod

Cloud9 should log you in at the /home/ec2-user/environment directory. Now we need to create a new site (directory) that will contain the theme files:

hugo new site NAME_OF_SITE -f yml
Hugo New Site Output

To install the PaperMod theme, change into the directory of your new site and run the following command:

git clone https://github.com/adityatelange/hugo-PaperMod themes/PaperMod --depth=1

You can also check for any theme updates by changing into your /themes/PaperMod folder and using:

git pull
PaperMod Install

Congratulations! You have successfully installed Hugo and PaperMod on your Cloud9 environment. Refer to Post 1.2 for instructions on how to launch your site locally for testing.