This repository contains the code and materials for my Amazon EKS with Terraform course. It holds the Terraform and Kubernetes code we build across the course, together with the written lab for each section under _labs/.
If you want to follow along from a clean slate, start from the Starter Project Repository: the same pinned toolchain and project scaffolding, without the code we write together.
Course link (with a big discount): https://www.lauromueller.com/courses/eks-terraform
- 👉 Argo CD and Argo Rollouts for GitOps: The Definitive Guide
- 👉 Prompt Engineering for Developers: The Definitive Guide
- 👉 Python for DevOps: Mastering Real-World Automation
- 👉 The Complete Docker and Kubernetes Course: From Zero to Hero
- 👉 The Definitive Helm Course: From Beginner to Master
- 👉 Mastering Terraform: From Beginner to Expert
- 👉 Mastering GitHub Actions: From Beginner to Expert
- 👉 Write better code: 20 code smells and how to get rid of them
I'm glad to have you here. Everything below gets your machine ready: a pinned toolchain, AWS access, and Terraform initialized against your own remote state. Once that is done, the infra/ project is the one we build on, section by section.
.devcontainer/: an opinionated devcontainer that installs Terraform, the AWS CLI, and kubectl at pinned versions, with shell completion and a zsh setup..tool-versions: the same pinned versions for a local install with mise or asdf..gitattributes: enforces LF line endings so the project behaves the same on every operating system..gitignore: keeps Terraform state, plans,.tfvars, and local kubeconfigs out of version control.infra/: the main Terraform project as it stands at the end of the course: inputs and locals, the VPC, the cluster and node IAM roles, the control plane, the networking addons, a spot node group, and the outputs.infra-module/: a second Terraform root that builds an equivalent cluster with the community EKS module, so you can compare it against the hand-written one.k8s/: ready-made Kubernetes manifests (an nginx Deployment and a LoadBalancer Service)._labs/: the written lab for each section, each with its goal, the configuration to target, and the tasks.
Pinned versions: Terraform 1.15.8, AWS CLI 2.36.4, kubectl 1.36.2. Pick one path.
- Devcontainer (recommended). Open the folder in an editor that supports the Dev Containers spec and reopen it in the container, or open it as a GitHub Codespace. It needs a Docker-compatible engine: Docker Desktop (on Windows, use the WSL2 backend), or Colima or Rancher Desktop in its dockerd (moby) mode on macOS or Linux. The container builds with the tools already installed.
- Local install. Install the pinned versions with mise or asdf from
.tool-versions(mise install), or install each tool by hand at those versions.
Confirm the versions either way:
terraform version # Terraform v1.15.8
aws --version # aws-cli/2.36.4
kubectl version --client # Client Version: v1.36.2Configure your credentials with an access key pair and confirm which identity you are authenticated as. The devcontainer presets the region to eu-central-1; to work in a different region, change AWS_REGION in .devcontainer/devcontainer.json.
aws configure
aws sts get-caller-identityTerraform state lives in an S3 bucket you own. The backend is a partial configuration, so you pass your bucket at init time; the region is read from AWS_REGION. If you do not already have a bucket for state, create one first.
cd infra
terraform init -backend-config="bucket=YOUR_STATE_BUCKET"Expect Successfully configured the backend "s3"! and Terraform has been successfully initialized!.
infra-module/ is a separate Terraform root with its own state. Initialize it the same way when you reach that section, and give it a distinct state key so the two roots can share one bucket without colliding:
cd infra-module
terraform init -backend-config="bucket=YOUR_STATE_BUCKET"The labs in _labs/ follow the order of the course. Each one describes the configuration to target rather than handing you the code, so you write it yourself and check it against this repository afterwards.
The cluster, the NAT gateway, the nodes, and the load balancer are all billed resources. Delete the nginx Service and tear the cluster down at the end of a session.
I'm looking forward to seeing you in the course!