Skip to content

This repository demonstrates a 3‑tier web application on AWS, built for scalability and modular design. It consists of a Web Tier (Nginx + Node.js), Application Tier (Node.js + Internal Load Balancer), and Database Tier (Amazon RDS MySQL).

Notifications You must be signed in to change notification settings

githubWithGHANA/aws-3tier-webapp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

3-Tier Architecture Application Deployment on AWS

📖 Overview

This repository documents the deployment of a 3-tier architecture on AWS, consisting of:

  • Web Tier (Nginx + Node.js)
  • Application Tier (Node.js + Internal Load Balancer)
  • Database Tier (Amazon RDS MySQL)

The setup ensures scalability, security, and high availability using VPC, Security Groups, Load Balancers, Auto Scaling Groups, and Route53.


📂 Repository Structure

aws-blue-green-deployment/
|
├── 3tier-app-deployment-aws-main/
│     ├── application-code
│           ├── apptier/
│           ├── webtier/
├── install.sh
├── screenshots/
│   ├── Images
├── README.md
└── architecture.png

🏗️ Architecture

  • VPC: Custom VPC (CIDR: 192.168.0.0/16) with 2 public and 4 private subnets.
  • Security Groups: Separate SGs for Web ALB, Web Server, App ALB, App Server, and Database.
  • Storage: S3 private bucket for application code and configuration files.
  • IAM: Role for EC2 with SSM permissions.
  • Database: RDS MySQL instance with private subnet group.
  • App Tier: Node.js application servers behind an internal ALB.
  • Web Tier: Nginx servers behind an external ALB with HTTPS via ACM.
  • Scaling: Auto Scaling Groups for both Web and App tiers.
  • DNS: Route53 for domain mapping.

🚀 Deployment Steps

1. Networking

  • Create VPC: 192.168.0.0/16
  • Subnets: 2 public, 4 private
  • NAT Gateway in one AZ
  • Security Groups:
    • Web ALB SG → allow HTTP/HTTPS from 0.0.0.0/0
    • Web SG → allow traffic from Web ALB SG
    • App ALB SG → allow traffic from Web SG
    • App SG → allow TCP 4000 from App ALB SG
    • DB SG → allow MySQL (3306) from App SG

2. Storage

  • Create S3 bucket: 3-tier-project-demo
  • Upload application code and install.sh
  • Update configs:
    • DbConfig.js → RDS credentials
    • nginx.conf → Internal ALB DNS

3. IAM

  • Create role: 3-tier-role
  • Trusted entity: EC2
  • Permissions: AmazonEC2RoleforSSM

4. Database

  • Create DB Subnet Group (tier-Subnet-Group)
  • Launch RDS MySQL instance (my3tierdb)
  • Update App Tier config with DB endpoint and credentials

5. Application Tier

  • Launch EC2 (Amazon Linux 2/2023, t2.micro) in private subnet
  • Attach IAM role
  • Connect via SSM
  • Install Node.js, PM2, MySQL client
  • Deploy app from S3
  • Configure internal ALB + target group (port 4000, health check /health)

6. Web Tier

  • Launch EC2 (Amazon Linux 2/2023, t2.micro) in public subnet
  • Install Node.js, Nginx
  • Deploy web code from S3
  • Replace default nginx.conf with custom config
  • Configure external ALB + target group (port 80, health check /)

7. HTTPS & DNS

  • Create ACM certificate
  • Attach certificate to external ALB listener
  • Configure Route53 domain: https://3tier-webapp.com

8. Auto Scaling

  • Create AMIs for App and Web servers
  • Define Launch Templates
  • Create ASGs with min/max/desired capacity
  • Attach respective ALBs

🛠️ Usage

Once deployed:

  • Access the application via the Route53 domain.
  • Web tier forwards requests to App tier through internal ALB.
  • App tier communicates with RDS MySQL database.

🤝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/new-feature)
  3. Commit changes (git commit -m 'Add new feature')
  4. Push to branch (git push origin feature/new-feature)
  5. Open a Pull Request

📜 License

This project is licensed under the MIT License.

About

This repository demonstrates a 3‑tier web application on AWS, built for scalability and modular design. It consists of a Web Tier (Nginx + Node.js), Application Tier (Node.js + Internal Load Balancer), and Database Tier (Amazon RDS MySQL).

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published