This project is a full-stack web application built using React js for the frontend, Express js for the backend, and MySQL as the database. The application is designed to demonstrate the implementation of a 3-tier architecture, where the presentation layer (React js), application logic layer (Express js), and data layer (MySQL) are separated into distinct tiers.
- To change the ssh key permission:
chmod 400 your_key.pem- To start ssh agent:
eval "$(ssh-agent -s)" - To add key to ssh agent:
ssh-add your_key.pem- To ssh into bastion host with agent forwarding:
ssh -A ec2-user@bastion_host_public_ip- To connect private instance from the bastion host:
ssh ec2-user@private_instance_private_ip - To download MySQL repository package:
wget https://dev.mysql.com/get/mysql80-community-release-el9-1.noarch.rpm- To verify the package download:
ls -lrt - To install MySQL repository package:
sudo dnf install -y mysql80-community-release-el9-1.noarch.rpm - To import GPG key:
sudo rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2023 - To update package index:
sudo dnf update –y - To install MySQL server:
sudo dnf install -y mysql-community-server - To start the mysql service:
sudo systemctl start mysqld- To enable mysql to start on boot:
sudo systemctl enable mysqld - To secure the mysql installation:
sudo grep 'temporary password' /var/log/mysqld.log
sudo mysql_secure_installation - To create database and restore data, please refer SQL scripts on db.sql file.
sudo yum update -y
sudo yum install git -y
git — versiongit clone https://github.com/learnItRightWay01/react-node-mysql-app.git- To install node version manager (nvm)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash- To load nvm
source ~/.bashrc- To use nvm to install the latest LTS version of Node.js
nvm install --lts- To test that Node.js is installed and running
node -e "console.log('Running Node.js ' + process.version)"PLEASE REFER ABOVE
PLEASE REFER ABOVE
PLEASE REFER ABOVE
dnf search nginx
sudo dnf install nginx
sudo systemctl restart nginx
nginx -vsudo cp -r dist /usr/share/nginx/html - Server name and root
server_name domain.com www.subdomain.com
root /usr/share/nginx/html/dist
- Setup reverse proxy
location /api {
proxy_pass http://application_tier_instance_private_ip:3200/api;
}
- Restart NGINX
sudo systemctl restart nginx
For AWS solutions - 06 and AWS solutions - 07
#!/bin/bash
# Update package lists
yum update -y
# Install Nginx
yum install -y nginx
# Stop and disable default service (optional)
systemctl stop nginx
systemctl disable nginx
# Create a custom welcome message file
echo "Welcome to Presentation Tier EC2 instance in Availability Zone B." > /usr/share/nginx/html/index.html
# Start and enable the Nginx service
systemctl start nginx
systemctl enable nginx

