๐ Multi-Tier ECS Fargate Deployment (React Frontend + Node Backend)
This project is a fully containerized multi-tier application deployed on AWS ECS Fargate, including:
- React Frontend
- Node.js Backend API
- Public and Internal ALBs
- Secure VPC architecture
- Private networking
- Manual deployments through AWS Console only
This project demonstrates production-grade AWS knowledge: VPC networking, subnets, ALBs, ECR, ECS Fargate, IAM, security groups, load balancing, internal service communication, and rolling updates.
All AWS-sensitive values are masked: AWS Account ID, region, ECR URIs, ALB DNS, cluster names, service names.
๐๏ธ Architecture Overview (Console Deployment)
Compute
- ECS Fargate Cluster
frontend-serviceโ โฆ
๐ Multi-Tier ECS Fargate Deployment (React Frontend + Node Backend)
This project is a fully containerized multi-tier application deployed on AWS ECS Fargate, including:
- React Frontend
- Node.js Backend API
- Public and Internal ALBs
- Secure VPC architecture
- Private networking
- Manual deployments through AWS Console only
This project demonstrates production-grade AWS knowledge: VPC networking, subnets, ALBs, ECR, ECS Fargate, IAM, security groups, load balancing, internal service communication, and rolling updates.
All AWS-sensitive values are masked: AWS Account ID, region, ECR URIs, ALB DNS, cluster names, service names.
๐๏ธ Architecture Overview (Console Deployment)
Compute
- ECS Fargate Cluster
frontend-serviceโ runs Reactbackend-serviceโ runs Node.js API- Each deployed using AWS Console โ Task Definition โ Service โ Deploy
Networking
- 1 VPC โ 10.0.0.0/16
- 2 Public Subnets (Frontend)
- 2 Private Subnets (Backend)
- Public ALB โ Frontend Tasks
- Internal ALB โ Backend Tasks
- Frontend โ Backend communication via internal ALB DNS
- NAT/VPC Endpoints (optional)
Container Registry
-
Two ECR repositories:
-
frontend-repo -
backend-repo
IAM
- ECS Task Execution Role
- ECS Task Role
- EC2/Jenkins roles (optional for image builds)
Deployment Method
- Everything deployed manually using the AWS Console
- Docker images built on EC2 and pushed to ECR manually
- Tasks and Services created through ECS Console
- Load balancers created through EC2 Console
- Target groups configured manually
- No automatic CI/CD is used in this project
๐ผ๏ธ Architecture Diagram (ASCII)
โโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Internet โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Public ALB (frontend-alb) โ
โ DNS: frontend-alb-xxxx.elb... โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ (HTTP /)
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ VPC (10.0.0.0/16) โ
โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโ PUBLIC SUBNETS โโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โ โ
โ โ โโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโ โ โ
โ โ โ FE Task (Fargate) โ โ FE Task (Fargate) โ โ โ
โ โ โ frontend-service โ โ frontend-service โ โ โ
โ โ โ Port: 80 โ โ Port: 80 โ โ โ
โ โ โโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโ โ โ
โ โ โ โ
โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โ
โ โ โ FRONTEND TARGET GROUP (HTTP:80) โ โ โ
โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โโโโโโโโโโโโโโโโโโโโโโโ PRIVATE SUBNETS โโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โ โ
โ โ โโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโ โ โ
โ โ โ BE Task (Fargate) โ โ BE Task (Fargate) โ โ โ
โ โ โ backend-service โ โ backend-service โ โ โ
โ โ โ Port: 5001 โ โ Port: 5001 โ โ โ
โ โ โโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโ โ โ
โ โ โ โ
โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โ
โ โ โ BACKEND TARGET GROUP (HTTP:5001) โ โ โ
โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โ
โ โ โ โ
โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โ
โ โ โ INTERNAL ALB (backend-alb) โ โ โ
โ โ โ DNS: internal-backend-alb-xxxx.elb... โ โ โ
โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ FE โ BE Calls:
โ Frontend โ http://internal-backend-alb/api/message โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Extra Components:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ECR (frontend + backend repos) for images โ
โ IAM Task Role for ECR pull โ
โ VPC Endpoints (optional: ECR, S3, Logs) โ
โ NAT Gateway (only if FE needs Internet access) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ Repository Structure
node-app-ecs-deployment/
โ
โโโ backend/
โ โโโ Dockerfile
โ โโโ package.json
โ โโโ server.js
โ โโโ routes/
โ
โโโ frontend/
โ โโโ Dockerfile
โ โโโ package.json
โ โโโ src/
โ
โโโ docker-compose.yml
โโโ Jenkinsfile_local (optional)
โโโ ecs-task-definitions/
โโโ backend.json
โโโ frontend.json
๐งช Local Development (docker-compose)
Run both services locally:
docker-compose up โbuild
- Frontend โ http://localhost:3000
- Backend โ http://localhost:5001
- React โ Node API tested locally
๐ณ Dockerfiles Overview
Backend Dockerfile
- Node.js 18 Alpine
- Installs dependencies
- Exposes port 5001
Frontend Dockerfile (Multi-Stage)
- Stage 1: React build
- Stage 2: Nginx serving static files
- Exposes port 80
๐ Image Tagging Strategy
- latest
- build-{timestamp}
- commit-hash
๐ฆ Manual Deployment Flow (AWS Console Only)
1. Build Docker images (EC2 or local)
docker build -t frontend . docker build -t backend .
2. Tag for ECR
docker tag frontend:latest xxxxxxxxxxxx.dkr.ecr.xx-xxxx-x.amazonaws.com/frontend-repo:latest
docker tag backend:latest xxxxxxxxxxxx.dkr.ecr.xx-xxxx-x.amazonaws.com/backend-repo:latest
3. Push to ECR
aws ecr get-login-password | docker login โฆ
docker push โฆ
4. Create Task Definitions (console)
- Add container ports
- Use awsvpc mode
- Assign task roles
5. Create Target Groups (frontend TG + backend TG)
6. Create ALBs
- Public ALB โ Frontend TG
- Internal ALB โ Backend TG
7. Create ECS Services (console)
- frontend-service in public subnets
- backend-service in private subnets
- Attach correct ALB target groups
- Set desired count = 2
8. Test Routing
- Frontend calls backend via ALB: http://internal-backend-alb/api/message
๐ Security Group Rules
Frontend SG
Inbound:
- 80 from ALB Public SG
Outbound:
- 80 to Backend SG
Backend SG
Inbound:
- 5001 from Frontend SG
Outbound:
- NAT or VPC endpoints
Public ALB SG
Inbound:
- 80 from world (0.0.0.0/0)
Internal ALB SG
Inbound:
- 80 from Frontend SG
๐ Rolling Deployment Behavior (Console)
- desiredCount: 2
- minHealthyPercent: 100
- maxPercent: 200
AWS launched new tasks โ waits for health โ drains old โ replaces โ zero downtime.
๐ธ Screenshots (to add)
- ALB page
- ECS service
- Task health
- Private subnets
- React frontend output
๐ Learnings
- Multi-tier AWS architecture
- Inter-service communication through Internal ALB
- Secure private/public subnet design
- ECS task design
- ALB listener rules
- Zero downtime deployments
- Networking fundamentals: SG, TG, ALB, subnets
- Real-world Docker โ ECR โ ECS flow
๐ Notes
- All ARNs, IDs, DNS names are masked.
- Replace placeholders in your own deployment.