This post is also published in blog.saeloun.com and featured in Ruby Weekly issue #653.

What is Amplify?

AWS Amplify is a full-fledged solution that lets us build, ship, and host full-stack applications on AWS using AWS services.

By using Amplify we can also host static sites and it has a fully managed CI/CD workflow which is super easy to set up it is as simple as connecting the git branch and setting up the domain.

Why we switched to Amplify?

Previously we hosted the Saeloun blog on Netlify but the problem is we are a large team and we want to add multiple users as team members to handle the build, and deployment of our blog. As Netlify charges $19/month per member(at the time of writing) we have to spend hundreds of dollars to run this blog.

We then migrated the blog to AWS Amplify because it supports most of the features we use in Netlify like PR preview and CI/CD pipeline. Most of all we can add unlimited users in Amplify and don’t have to pay any additional charges based on user count.

Amplify pricing is based on,

Amplify pricing page has examples of calculating the per-month charge ref.

After migrating to Amplify we are paying less than $50 per month.

Setup a Jekyll blog in AWS Amplify:

1) Adding repository branch

Note: You must have administrator privileges for the git repository to set up the Jekyll blog in AWS Amplify.

2) Build setting

At the time of writing the Dockerfile used by AWS Amplify uses only Ruby 2.4 and 2.6 but to deploy our blog we have to install Ruby 3.2.0 and other Linux libraries which we can install by adding commands in preBuild or we can build our own custom Docker image and use it.

- rvm install 3.2.0
- rvm use 3.2.0
- yum -y install gsl-devel
- bundle install

Found this workaround in this GitHub issue.

permission

3) Review

Review the repository details and app settings and click on the Save and Deploy button.

This will start creating the app in Amplify, we can see the progress of deployment in the dashboard once the deployment is completed we can access the site with the URL provided by Amplify.

permission

4) Setting up a domain

If the site works fine then we can point the static site hosted in Amplify to the custom domain.

permission

permission

permission

permission

permission

permission

permission

5) Enable preview

In the side navbar click on the Previews option under App settings, then click on Enable Preview and Install the GitHub app in the repository.

Now whenever a new PR is raised Amplify will build the app and when the build is successful Amplify bot will post the preview link as a comment on the PR.

Conclusion

Along with Jekyll, Amplify can also host Gatsby and Next.js sites and if you are looking for a way to cut down costs on hosting your blog or other static sites without paying any additional cost based on user count then AWS Amplify will be the best alternative for you.