AWS Amplify boasts a significant number of features, including the ability to create and support:
Authentication through Cognito
APIs using REST and GraphQL
FaaS through the use of Lambda
Storage through S3 Bucket
Database Storage through DynamoDB
Managed CI\CD pipeline for deployment
and many more features
Prerequisites
An AWS Account (See the References section for account registration guides)
A supported git provider, which includes GitHub, Bitbucket, GitLab and CodeCommit (note: CodeCommit is not available to new customers)
GoHugo cli tool installed (See references section for details on how to install GoHugo for your operating systems)
Step 1 - Getting Setup Locally
Assuming you have GoHugo installed, let’s create a website called “sample-gohugo”. To do this, let’s run the command:
hugo new site sample-gohugo
Once the new site has been created, let’s add it to a git repository called sample-gohugo. I’m deploying PaperMod to a dedicated branch called papermod for testing.
Next, we need to select the theme installation method. I’ve selected the Papermod theme which has several methods of installation, these include:
Git Clone Method
Git Submodule Method
Downloading and Unzipping
Lastly, installation can be done via the Hugo module method.
Given that the submodule method is the recommended approach, I will go with this one. (For information on where I got this command please see the reference section and the PaperMod wiki)
Next, we will configure the config.yml file with the theme we want by adding the line below
I’ve copied the sample configuration from the PaperMod wiki and tweaked it slightly for this article but feel free to tweak it to your liking.
Before we test out the server locally lets add a sample post page.
Now let’s update the sample-post.md with the following content.
Now we can test the server locally
Here we can see the localhost running
Let’s navigate the webpage and hey presto we have a local hosted version available.
But what if we want our adoring fans to the see it? Well this is where amplify comes into the play. So let’s commit those changes to the code.
Now let’s proceed to deploying this with AWS Amplify.
Step 2 - Deploying it in AWS Amplify
Login into your AWS Console and navigate to AWS Amplify, we should be able to see some of our Amplify Applications. Here you can see where I have deploy my personal blog. Let’s select the Create net app button.
In the next screen we can see a variety of applications that can be deployed to including frameworks such as:
React
Angular
Vue
Next.js
In addition, we can see the Version Control provider that can be stored, these include:
GitHub (which we used in Step 1)
Bitbucket
CodeCommit (deprecated for new AWS customers)
and GitLab
You can also deploy without Git, but seriously why are you not using Git. (If you are someone who deploys applications to Amplify without Git, I’d love to understand the motivation or benefits of this approach so please reach out to me if you have any insights on this)
Let’s select GitHub and then the Next button.
In the next screen we need to configure our access to sample-gohugo repo. Note: I’ve connected this account to GitHub before so you might see different screens to what I’m displaying here.
Once permissions are applied we can return to the App setting for our Amplify Application.
Add the repository sample-gohugo and the papermod branch
In the screen below I need to update the Build output directory to public.
Also the version of PaperMod I’m using required the latest version of Hugo. So I need to update my build settings to the following.
If you select Edit YML file then you should be able to update the yaml file with the following. Then click save
Then select Next
Conduct on final last review then hit Save and deploy
This will kick off the build process once this is complete we should be able to visit our website.
Step 4 - Check the Website
You should now have the bare bone structure for deploying a sample hugo site using AWS Amplify.
Please see the reference below for any of the details for themes, GoHugo installation, AWS account registration and the PaperMod theme wiki which was used for this blog.