This repository provides a ready-to-use Infrastructure as Code (IaC) bootstrap template using Terragrunt and Terraform to deploy AWS infrastructure (VPC, EKS, budgets, Kubernetes base config, namespaces) in a modular and reusable way.
It supports spot instances, autoscales based on cluster load, configures AWS budget alerting, and is designed to make use of AWS Free Tier resources as much as possible.
All tooling (Terraform, Terragrunt, AWS CLI helpers) is packaged in a Docker image:
devopsinfra/docker-terragrunt
This ensures:
- No manual local installs required
- Consistent developer environments
- Identical local and CI environments
Infrastructure components:
- terraform-aws-eks
- Kubernetes Provider for Terraform
- Helm Provider for Terraform
- AWS Budgets for cost monitoring and alerting
Software components:
- Ingress controller: traefik
The project use the standard terragrunt project structure, detailed explication here.
- AWS CLI configured with necessary permissions
- Docker & Docker Compose
3.x
: For creating consistent, reproducible environments for the application, tests, and development (Jupyter). - Taskfile: A simple,
make
-like build tool for automating common commands (e.g., running the job, tests).
Note: You do not need to install Terraform or Terragrunt locally. All commands run inside
devopsinfra/docker-terragrunt
to guarantee consistent versions between local and CI.
- Assume your AWS admin role, make sure you have AWS environments variables with shell
❯ env | grep AWS
AWS_ACCESS_KEY_ID=xxxxxx
AWS_SECRET_ACCESS_KEY=xxxxxx
AWS_SESSION_TOKEN=xxxxxx
-
Run format check:
task fmt
-
Validate configuration
task validate
-
Plan infrastructure changes:
task plan
-
Apply infrastructure changes:
task apply
-
Configure kubectl:
aws eks --region eu-west-1 update-kubeconfig --name <cluster-name>
- Verify cluster and pods:
kubectl get pods -n kube-system
kubectl get pods -n default
The file format validation is run on pull requests to ensure code consistency and prevent formatting drift.
This IaC setup also provisions AWS Budgets to send alerts when costs approach or exceed defined thresholds. Where possible, it uses AWS Free Tier–eligible services and configurations to minimize costs during development and testing.