https://github.com/mongoexpuser/nodejs-load-balancer-on-ec2
Load Balancing of Web or Application Servers with NodeJS
https://github.com/mongoexpuser/nodejs-load-balancer-on-ec2
aws cloud-provider ec2 load-balancer logger-middleware nodejs
Last synced: 10 months ago
JSON representation
Load Balancing of Web or Application Servers with NodeJS
- Host: GitHub
- URL: https://github.com/mongoexpuser/nodejs-load-balancer-on-ec2
- Owner: MongoExpUser
- License: mit
- Created: 2023-12-03T01:12:50.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-12-14T09:44:03.000Z (about 2 years ago)
- Last Synced: 2025-01-26T19:37:25.243Z (12 months ago)
- Topics: aws, cloud-provider, ec2, load-balancer, logger-middleware, nodejs
- Language: JavaScript
- Homepage:
- Size: 121 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## Nodejs-Load-Balancer-On-EC2
Load Balancing of Web or Application Servers with a NodeJS load balancer (lb) application.
## Architectural Diagram

## Purpose
* Load Balancing of Web or Application Servers on AWS EC2 machine.
* The current demonstration is for an AWS EC2 instance but the NodeJS application can be run on any cloud provider VM e.g (Linode, GCP, Azure, OCI, DO, etc.) as long as the network is properly set up.
## Advantages
* Fast.
* Cheaper.
* Easy to deploy.
* Load requests across multiple machines globally.
## Install Dependency
* NodeJS 19+ or above (https://nodejs.org/en/download)
## Run App
* To run the load balancing app:
- Download the following source files in this repository:
- appLB.js
- common.js
- config.json
- Edit relevant input variables within the config.json file, as deem necessary.
- Upload the source files to the same folder on an AWS EC2 machine.
- Then, run the appLB.js script from within the folder as:
sudo node --inspect=$((9233 + $RANDOM % 100)) --trace-warnings --trace-deprecation --watch appLB.js
# License
Copyright © 2023. MongoExpUser