Terraforming a Blog:
The Setup


Why engineer something when you can overengineer it?

As I am just getting back into cloud, I looked up many different videos and articles about how I should learn cloud engineering. The first one that caught my eye was to start a blog site. There are tons of good options to start a blog with, but I decided why not try to create one myself as an initial project. I also hate writing and never know what to write about, so I figured building the project first would give me something to actually write about. Anddd that’s what this is!

The Stack

  • Github - Allows for version control and CICD pipeline via Actions
  • Terraform - Allocate Resources needed to Run my website
  • AWS - Backend Terraform allocates resources from
    • S3 - Where my website is hosted as well as Terraform State
    • CloudFront - Content Distribution for my website
    • ACM - TLS Certification for CloudFront
    • Route 53 - DNS and Domain
    • AWS Budgets for cost alerts
    • IAM - Defines exactly what each identity is allowed to do
      • SSO - Gives me temporary access to run Terraform locally via CLI, nothing stored
      • OIDC - Gives GitHub Actions temporary access to push site to S3, nothing stored

Deployment Pipeline

Deployment pipeline: CLI push triggers GitHub Actions, which assumes an AWS role via OIDC, builds the site, syncs assets and HTML to S3 separately, then resolves the CloudFront distribution ID and invalidates it

After pushing to my GitHub’s main branch, GitHub Actions trigger. The actions trigger an npm run build which creates dist/ output which will be pushed to the website’s S3 bucket. When syncing to S3, assets are stored, cached, and immutable – On the other hand html is stored, but not cached, so if I decided to add another blog, the html doesn’t get stuck and show old pages on the website. After that, I look up the CloudFront distribution ID and invalidate everything there, so CloudFront, the content distributor, doesn’t get stuck sending old copies of the website.

Why should you care?

This may not be for those who are less interested in tech and just want something up and running asap. This set up requires understanding of cloud but does give it to you in the process of creation. The ultimate upside is the control, free tier managed services only go so far, then the next tier requires payment. At some point you will hit your limit then have to spend to push the limits further out. That said, there is a reason they charge for their services, there’s a lot that I have not covered about security and dynamic sites here.

What’s Next

This is just the beginning. I have set up my blog website using Terraform, I plan to improve on the site itself while blogging about it. My next blog will go into further detail about the OIDC bug I encountered and how I fixed it. This is to teach and to learn. What I did may be helpful to you, but it definitely will be helpful for me! Happy Learning!