This project is a simple To-Do List application, containerized and deployed on AWS EKS with Terraform. It demonstrates a full-stack setup using a React frontend, Node.js/Express backend, and PostgreSQL database, all managed in an AWS EKS (Elastic Kubernetes Service) cluster. The frontend and backend images are available on Docker Hub, making it easy for others to clone and deploy this application with minimal configuration.

- Create To-Dos: Add new items to your list.
- Delete To-Dos: Remove items when completed.
- Data Persistence: All items are stored in a PostgreSQL database.
- Fully Containerized: Frontend, backend, and database are containerized and deployed on AWS EKS using Terraform.
- A JavaScript library for building user interfaces.
- A JavaScript runtime built on Chrome's V8 engine.
- A minimal and flexible Node.js web application framework.
- A powerful, open-source object-relational database system.
- A platform for developing, shipping, and running applications inside containers.
- An open-source Infrastructure as Code software tool.
- A managed Kubernetes service provided by AWS.
This project has a simple three-tier architecture:
- Frontend (React): Manages the user interface and interacts with the backend.
- Backend (Node.js/Express): Handles API requests, processes data, and communicates with the database.
- Database (PostgreSQL): Stores the To-Do items, ensuring data persistence.
- Frontend: Deployed on a public subnet with a LoadBalancer.
- Backend: Deployed on a private subnet, accessed by the frontend via ClusterIP.
- Database: Deployed using AWS RDS, accessed by the backend in the same VPC for security.
- AWS Account: Required for deploying EKS, RDS, and other resources.
- AWS CLI Make sure the AWS Command Line Interface is installed.
- Terraform: Ensure Terraform is installed (version 0.13+).
- kubectl: Ensure Kubernetes command-line is installed.
-
Clone the repository:
git clone https://github.com/mrgitics/todo-app-eks-terraform.git cd todo-app-terraform-eks -
Configure AWS credentials:
Ensure that your AWS CLI is configured. Run the following command to enter your AWS Access Key, Secret Key, region, and output format:
aws configure
-
Modify Terraform variables:
Adjust variables in terraform.tfvars as needed. This file contains settings for: AWS Region Cluster name Instance type for EKS nodes Database credentials (Note: these are stored in plain text for demonstration purposes)
-
Deploy with Terraform:
terraform init terraform plan terraform apply
Terraform will set up the VPC, subnets, EKS cluster, RDS instance, and deploy the application to EKS.
Troubleshooting
If you encounter errors related toapp_deploymentwhen runningterraform apply, it may be because the EKS cluster has not yet been fully created or configured. To resolve this, try applying Terraform in two stages:-
Stage 1: Run Terraform for the infrastructure setup only (EKS cluster, VPC, and security groups):
terraform apply --target=module.eks_cluster --target=module.vpc --target=module.security_group --target=module.iam_roles
-
Stage 2: Once the infrastructure is created, configure
kubectlto connect to the EKS cluster:aws eks update-kubeconfig --region <your-region> --name <your-cluster-name>
-
Stage 3: After verifying
kubectlconnectivity, apply the remaining Terraform configuration to deploy the application:terraform apply
Following these steps should allow Terraform to complete successfully without encountering
app_deploymenterrors. After deployment, the frontend service’s external IP will be available in the output, and you can access the application through that IP. -
-
Access the Application:
Copy the external IP from the Terraform output or use kubectl get services to find it. Open http://:3000 in your browser to use the To-Do List app.
To destroy the infrastructure and avoid incurring additional costs:
terraform destroy
Frontend (React): Exposed via LoadBalancer on port 3000
Backend (Express): Internal ClusterIP on port 5001
Database (PostgreSQL): Managed by RDS, accessible only within the VPC
Docker Images
Frontend Image: mrgitics/todo-frontend on Docker Hub
Backend Image: mrgitics/todo-app-backend on Docker Hub
EKS Cluster: Manages the deployment of frontend and backend applications.
LoadBalancer: Exposes the frontend to the internet.
ClusterIP: Internal networking for backend and database access.
Security: This setup uses basic security configurations suitable for testing and demonstration.
Developed by Andor Margitics as part of a DevOps exercise to demonstrate containerization, Terraform deployment, and AWS EKS orchestration.