Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Three-Tier Application on Amazon EKS

A production-style three-tier application deployed on Amazon EKS using Terraform, Docker, Amazon ECR, Kubernetes, and AWS networking services.

🏗️ Architecture

Internet │ ▼ AWS Load Balancer │ ▼ Frontend (React) │ ▼ Backend (Node.js) │ ▼ MongoDB │ ▼ Persistent Storage (EBS)

🚀 Technologies

  • AWS
  • Amazon EKS
  • Terraform
  • Kubernetes
  • Docker
  • Amazon ECR
  • AWS VPC
  • NAT Gateway
  • Application Load Balancer
  • IAM
  • OIDC
  • AWS Load Balancer Controller
  • EBS CSI Driver
  • MongoDB
  • Node.js
  • React
  • Vite

📁 Project Structure

three-tier-eks/ ├── backend/ │ ├── Dockerfile │ ├── package.json │ ├── server.js │ └── .dockerignore │ ├── frontend/ │ ├── src/ │ │ ├── App.jsx │ │ └── main.jsx │ ├── Dockerfile │ ├── package.json │ ├── index.html │ ├── vite.config.js │ └── .dockerignore │ ├── kubernetes/ │ ├── backend/ │ ├── database/ │ ├── frontend/ │ ├── ingress/ │ └── namespace.yaml │ ├── terraform/ │ ├── vpc.tf │ ├── subnets.tf │ ├── internet.tf │ ├── nat.tf │ ├── security_groups.tf │ ├── iam.tf │ ├── eks.tf │ ├── ecr.tf │ ├── oidc.tf │ ├── alb-controller-iam.tf │ ├── alb-controller-policy.json │ ├── ebs-csi.tf │ ├── provider.tf │ ├── versions.tf │ ├── variables.tf │ └── outputs.tf │ ├── .gitignore └── README.md

☁️ AWS Infrastructure

Terraform provisions:

  • Custom VPC
  • Two public subnets
  • Two private subnets
  • Internet Gateway
  • NAT Gateway
  • Route tables
  • Security groups
  • Amazon EKS cluster
  • Managed EKS node group
  • Amazon ECR repositories
  • IAM roles and policies
  • OIDC provider
  • AWS Load Balancer Controller IAM configuration
  • EBS CSI driver configuration

☸️ Kubernetes

The application consists of three tiers.

Frontend

React application running inside Kubernetes.

Backend

Node.js API responsible for application logic and communication with MongoDB.

Database

MongoDB deployed inside Kubernetes with persistent storage using a PersistentVolumeClaim.

Ingress

AWS Load Balancer Controller exposes the application through an Application Load Balancer.

🔧 Prerequisites

Install:

  • AWS CLI
  • Terraform
  • kubectl
  • Helm
  • Docker
  • Git

Configure AWS credentials:

aws configure

Configure the AWS region:

aws configure set region eu-north-1

🚀 Deployment

1. Initialize Terraform

cd terraform
terraform init

2. Format and validate

terraform fmt
terraform validate

3. Review infrastructure

terraform plan

4. Deploy infrastructure

terraform apply

5. Configure kubectl

aws eks update-kubeconfig --region eu-north-1 --name three-tier-eks

Verify the cluster:

kubectl get nodes

🐳 Build Container Images

Build the backend:

cd backend
docker build -t three-tier-backend .

Build the frontend:

cd frontend
docker build -t three-tier-frontend .

Push the images to Amazon ECR before deploying the Kubernetes workloads.

☸️ Deploy Kubernetes Resources

Create the namespace:

kubectl apply -f kubernetes/namespace.yaml

Deploy MongoDB:

kubectl apply -f kubernetes/database/

Deploy the backend:

kubectl apply -f kubernetes/backend/

Deploy the frontend:

kubectl apply -f kubernetes/frontend/

Deploy the ingress:

kubectl apply -f kubernetes/ingress/

Check pods:

kubectl get pods -A

Check services:

kubectl get svc -A

Check ingress:

kubectl get ingress -A

🔍 Verification

Check EKS:

aws eks describe-cluster --region eu-north-1 --name three-tier-eks

Check nodes:

kubectl get nodes

Check pods:

kubectl get pods -A

Check deployments:

kubectl get deployments -A

Check services:

kubectl get svc -A

Check ingress:

kubectl get ingress -A

💰 Cost Warning

This project creates AWS resources that may incur charges, including:

  • NAT Gateway
  • EKS control plane
  • EC2 worker nodes
  • Load Balancer
  • EBS volumes
  • ECR storage

When finished testing, destroy the infrastructure:

cd terraform
terraform destroy

🎯 Learning Goals

This project demonstrates practical experience with:

  • Infrastructure as Code using Terraform
  • AWS networking
  • Amazon EKS
  • Kubernetes workloads
  • Containerization with Docker
  • Amazon ECR
  • Kubernetes persistent storage
  • IAM and OIDC
  • AWS Load Balancer Controller
  • Kubernetes Ingress
  • Three-tier application architecture

👨‍💻 Author

Revanth

Built as a hands-on DevOps and Cloud Engineering project.

About

Production-style three-tier application deployed on Amazon EKS using Terraform, Docker, Kubernetes, Amazon ECR, AWS VPC, IAM, Load Balancer Controller, and MongoDB. Built to demonstrate real-world Cloud & DevOps infrastructure, containerization, Kubernetes orchestration, and Infrastructure as Code.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages