A lightweight, responsive web calculator built with Angular 17, developed and deployed on AWS EC2 instances with Nginx hosting.
This project demonstrates a complete build-and-deploy pipeline using Node.js, Angular CLI, and secure SSH transfer between servers.
This project involves:
- Setting up two EC2 servers (Build & Deploy)
- Building the Angular application using Node.js and Angular CLI
- Transferring production build artifacts to the deployment server
- Hosting the Angular app using Nginx
| Server | Role | Purpose |
|---|---|---|
| Build Server | Development & Build | Compiles the Angular app and produces the production-ready build files |
| Deploy Server | Hosting | Serves the static files using Nginx |
| Communication | Secure Copy (SCP) | .pem key used for SSH and file transfer between instances |
```bash
sudo apt -y update
sudo apt-get install -y nodejs
sudo apt install npm -y
````
git clone https://github.com/Ai-TechNov/AngularCalculator.git
cd AngularCalculator
Manually edited:
package.jsonโ updated to latest Angular dependenciesangular.jsonโ adjusted for modern Angular schema compliance
npm install
sudo npm install -g @angular/cli@latestWhen the build showed:
Node.js version v18.19.1 detected.
The Angular CLI requires a minimum Node.js version of v20.19 or v22.12.
Updated Node to the latest version:

sudo apt remove -y nodejs
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt install -y nodejsVerify:
node -v # v20.19.5
npm -v # 10.8.2Clean cache and verify Angular CLI:
sudo npm cache clean -f
ng versionEnable autocompletion:
ng completionBuild the Angular app for production:
ng build --configuration productionThe build output is generated inside:
/home/ubuntu/AngularCalculator/dist/angularCalc
Transfer build files using .pem SSH key:
sudo chmod 400 Linux-Practice.pem
scp -i Linux-Practice.pem /home/ubuntu/AngularCalculator/dist/angularCalc/* ubuntu@13.51.160.159:/home/ubuntu/
sudo apt update -y
sudo apt install nginx -ysudo mv * /var/www/html/sudo systemctl status nginxExpected output:
nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; preset: enabled)
Active: active (running)
Optional cleanup:
sudo rm -rf /var/www/html/index.nginx-debian.htmlโ
The Angular app is now hosted and accessible via:

http://<Deploy-Server-Public-IP>/
AngularCalculator/
โโโ dist/
โ โโโ angularCalc/
โ โโโ index.html
โ โโโ main.js
โ โโโ runtime.js
โ โโโ styles.css
โ โโโ polyfills.js
โ โโโ assets/
โโโ src/
โโโ package.json
โโโ angular.json
โโโ README.md
-
Only ports 22 (SSH) and 80 (HTTP) were opened.
-
.pemkey permissions restricted using:chmod 400 Linux-Practice.pem
-
No sensitive environment variables are stored in the codebase.
| Component | Version | Purpose |
|---|---|---|
| Angular | 17.3.x | Frontend Framework |
| Node.js | 20.19.x | JavaScript Runtime |
| NPM | 10.8.x | Package Manager |
| Nginx | Latest | Web Server for static hosting |
| Ubuntu | 22.04 LTS | OS for EC2 servers |
Run the app locally:
ng serveBuild for production:
ng build --configuration productionDeploy and test via browser:
http://<your-server-ip>/
| Issue | Cause | Solution |
|---|---|---|
ng: command not found |
Angular CLI not installed globally | sudo npm install -g @angular/cli@latest |
Node.js version too low |
Node < 20 | Reinstall Node 20 LTS |
Schema validation failed |
Old angular.json |
Replace with Angular 17 schema |
Port already in use |
Nginx already running | sudo systemctl restart nginx |
Sivaiah Jagadapi Power BI Developer | Cloud & DevOps Enthusiast ๐ Hyderabad, India ๐ GitHub: Ai-TechNov
This project is open-source under the MIT License. You are free to modify, distribute, and reuse the code with attribution.
---
โ
**Now do this:**
1. Copy everything above (from `# ๐งฎ Angular Calculator App` to the end).
2. Paste into your projectโs `README.md`.
3. Commit and push:
```bash
git add README.md
git commit -m "Added detailed project documentation"
git push
Would you like me to add a visual architecture diagram (Build โ SCP โ Deploy โ Nginx) as Markdown image placeholder at the top of your README?