Skip to content

A comprehensive guide to deploying a React Frontend, Node.js Backend, and MongoDB database on Amazon EKS using Docker, ECR, Helm, Kubernetes, and the AWS Load Balancer Controller.

Notifications You must be signed in to change notification settings

AdityaKonda6/Three-Tier-Application-AWS-EKS

Repository files navigation

🌐 Three-Tier Application Deployment on AWS EKS

A comprehensive guide to deploying a React Frontend, Node.js Backend, and MongoDB database on Amazon EKS using Docker, ECR, Helm, Kubernetes, and the AWS Load Balancer Controller.


πŸ—οΈ Three-Tier Application Architecture

image

πŸ—οΈ Kubernetes Architecture

image

πŸ“˜ Table of Contents


🧩 Overview

This project deploys a three-tier cloud-native application on AWS EKS:

Tier Component Technology Description
1️⃣ Presentation React Frontend Docker, Kubernetes Provides UI, runs on port 3000
2️⃣ Application Node.js Backend API Docker, Kubernetes Handles business logic on port 3500
3️⃣ Data MongoDB Stateful Kubernetes Deployment Stores application data
🌐 External Routing AWS ALB Ingress Controller ALB Publishes services publicly

Special thanks to LondheShubham153 for helping improve this project!

Watch the video

Use these Kubernetes Cheat Sheet for improving the knowledge on Kubernetes and skills needed for this project!


Kubernetes cheat sheet

πŸ” Architecture Flow

1. Frontend (React)

  • Dockerized and pushed to Amazon ECR
  • Deployed using Helm in Kubernetes

2. Backend (Node.js)

  • Packaged as Docker image β†’ stored in ECR
  • Deployed via Helm with environment variables and MongoDB connection string

3. MongoDB

  • Runs as a Kubernetes Deployment + Persistent Volume Claim
  • Secured with k8s Secrets

4. Docker

  • All components are built and tagged locally
  • Images pushed to ECR for deployment

5. ECR (Elastic Container Registry)

  • Stores Docker images consumed by Kubernetes

6. Kubernetes Cluster

Handles:

  • Rolling updates
  • Auto-healing
  • Networking
  • Scaling
  • Pod lifecycle

7. Ingress

  • AWS ALB Ingress routes external traffic
  • Separate routes for frontend (/) and backend (/api)

8. Load Balancer

  • Public ALB endpoint
  • Routes traffic to Ingress Controller

9. Users

  • Access the application via ALB FQDN or domain name

πŸ“¦ Prerequisites

Before deploying, ensure you have:

  • An AWS account

  • IAM permissions for:

    • EKS
    • ECR
    • IAM Roles
    • ALB Ingress Controller
  • Local copies of:

    • backend-chart/
    • frontend-chart/

πŸ› οΈ Tool Installation

1. Install AWS CLI

curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o awscliv2.zip
unzip awscliv2.zip
sudo ./aws/install
aws --version

2. Configure AWS Credentials

aws configure

3. Install kubectl

curl -o kubectl https://s3.us-west-2.amazonaws.com/amazon-eks/1.29/latest/bin/linux/amd64/kubectl
chmod +x kubectl
sudo mv kubectl /usr/local/bin/
kubectl version --client

4. Install Helm

curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash
helm version

☸️ Cluster Access Setup

aws eks update-kubeconfig --name <CLUSTER_NAME> --region <REGION>
kubectl get nodes

πŸš€ Deployment Chronology

Below is the exact sequence used to deploy your application.


πŸƒ MongoDB Deployment

Apply your MongoDB manifest:

kubectl apply -f mongo_manifests.yaml
kubectl get pods -n three-tier

This includes:

  • Secret
  • PersistentVolume
  • PersistentVolumeClaim
  • Service
  • Deployment

βš™οΈ Backend Deployment

Fix applied: liveness/readiness probe indentation and path update (/ok)

Deploy with Helm:

helm upgrade backend-release ./backend-chart \
  --namespace three-tier-app \
  --set image.repository="534232118663.dkr.ecr.ap-south-1.amazonaws.com/three-tier-backend-ecr" \
  --set image.tag="latest" \
  --set mongo.serviceName="mongodb-svc.workshop.svc.cluster.local" \
  --set mongo.servicePort=27017

Validate

kubectl get pods -n three-tier-app

🎨 Frontend Deployment

helm upgrade frontend-release ./frontend-chart \
  --namespace three-tier-app \
  --set image.repository="534232118663.dkr.ecr.ap-south-1.amazonaws.com/three-tier-frontend-ecr" \
  --set image.tag="latest" \
  --set service.port=3000

🌍 Ingress / External Access

Fix applied:

Converted JSON-style annotations to YAML block style.

Apply Ingress using Helm:

helm upgrade frontend-release ./frontend-chart \
  --namespace three-tier-app \
  --set ingress.enabled=true \
  --set ingress.className="alb" \
  --set ingress.annotations."alb\.ingress\.kubernetes\.io/scheme"=internet-facing \
  --set ingress.annotations."alb\.ingress\.kubernetes\.io/target-type"=ip \
  --set ingress.annotations."alb\.ingress\.kubernetes\.io/listen-ports"='[{"HTTP":80}]' \
  --set ingress.hosts[0].host="frontend.amanpathakdevops.study" \
  --set ingress.hosts[0].paths[0].path="/" \
  --set ingress.hosts[0].paths[0].pathType="Prefix" \
  --set ingress.hosts[0].paths[1].path="/api" \
  --set ingress.hosts[0].paths[1].pathType="Prefix" \
  --set ingress.hosts[0].paths[1].backend.service.name="backend-release-backend-chart" \
  --set ingress.hosts[0].paths[1].backend.service.port.number=3500

πŸ” Verification

Check ALB hostname:

kubectl get ingress -n three-tier-app

When ALB provisioning is complete, add a CNAME record pointing:

frontend.amanpathakdevops.study --> <ALB DNS Name>

Then access your app:

http://frontend.amanpathakdevops.study

🧹 Cleanup

eksctl delete cluster --name three-tier-cluster --region us-west-2

About

A comprehensive guide to deploying a React Frontend, Node.js Backend, and MongoDB database on Amazon EKS using Docker, ECR, Helm, Kubernetes, and the AWS Load Balancer Controller.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published