Overview
To demonstrate the journey from a Terralith to a scalable Terragrunt setup, we will build and deploy a complete, real-world application early on in this guide, then spend the rest of the guide refactoring the IaC that manages the infrastructure hosting it.
The architecture for our sample project is a simple serverless web application hosted in AWS, which consists of three main components:
- A Lambda-backed website.
- An S3 bucket to store static assets.
- A DynamoDB table to store metadata on those assets.
This application will allow users to view and vote on their favorite AI-generated images of cats. We’ve intentionally chosen these AWS serverless offerings as they are cost-effective and should be very cheap, if not free, for anyone following along with a new AWS account.
What You’ll Need
Section titled “What You’ll Need”To provision the application we build as part of this guide, you will need an AWS account, and permissions to provision resources within it. If you don’t have one, you can follow the official instructions to sign up for one for free.
To manage the development dependencies for this project, this guide uses mise, a tool that helps manage project-specific runtimes and tools. You are welcome to install the required tools manually, but using mise
(or another tool manager) is recommended when working with IaC, as reproducibility is paramount for ensuring that you can work effectively with colleagues (including future you) on shared infrastructure.
If you are happy to install development dependencies with mise
, you can install it using the official Mise installation guide.
If you would like to manually install all the development dependencies for this guide, you can install them here:
We will build this project from the ground up, but if you get lost at any point or want to skip ahead, you can find the completed project (as of each step) here.
Note that the content shown in code fences in this project will always be displayed in totality, so you can either copy them directly into the filename that’s labeled at the top of the code fence for a file, or run the command directly in your terminal for commands. If a command starts with a $
, the intent of the code fence is to demonstrate expected output, so you aren’t expected to copy and paste it directly into your terminal.