+--------------------+ +--------------------+ +--------------------+
| Web Server | ---> | App Server | ---> | DB Server |
| (Flask Frontend) | | (Flask + SQLAlchemy| | (MySQL DB) |
| Port: 5000 | | + JWT Auth) | | Port: 3306 |
+--------------------+ +--------------------+ +--------------------+
sudo apt update
sudo apt install mysql-server -y
sudo systemctl enable mysql
sudo systemctl start mysql
sudo mysql_secure_installation
VALIDATE PASSWORD COMPONENT can be used to test passwords and improve security. It checks the strength of password and allows the users to set only those passwords which are secure enough. Would you like to setup VALIDATE PASSWORD component?
Press y|Y for Yes, any other key for No: n
Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y
Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y
Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
If it doesn’t ask for a root password — that’s fine (Ubuntu uses auth_socket authentication).
sudo mysql
Inside MySQL shell:
CREATE DATABASE appdb;
CREATE USER 'appuser'@'%' IDENTIFIED WITH mysql_native_password BY 'app123';
GRANT ALL PRIVILEGES ON appdb.* TO 'appuser'@'%';
FLUSH PRIVILEGES;
EXIT;
sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf
Find this line:
bind-address = 127.0.0.1
Change it to:
bind-address = 0.0.0.0
Then restart MySQL:
sudo systemctl restart mysql
sudo mysql
SELECT user, host, plugin FROM mysql.user;
You should see:
| appuser | % | mysql_native_password |
That means Flask’s mysqlclient driver can connect successfully.
sudo apt update
sudo apt install python3-full python3-pip pkg-config python3-dev default-libmysqlclient-dev build-essential -y
git clone https://github.com/kushall1845/Vcube_App.git
cd Vcube_App/app_server
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
pip install mysqlclient
To verify installation:
pip show mysqlclient
export DATABASE_URL="mysql://appuser:app123@<DB_SERVER_PRIVATE_IP>/appdb"
export SECRET_KEY="supersecretkey"
export APP_HOST="0.0.0.0"
export APP_PORT=5001
(Replace <DB_SERVER_PRIVATE_IP> with your MySQL instance’s private IP)
python3
from app import app, db
with app.app_context():
db.create_all()
double click on enter after pasting
To exit
exit()
If no error, tables are created in appdb.
You can verify on DB server:
sudo mysql
USE appdb;
SHOW TABLES;
Should show:
| user |
nohup python3 app.py > app_server.log 2>&1 &
sudo apt update
sudo apt install python3-full python3-pip -y
git clone https://github.com/kushall1845/Vcube_App.git
cd Vcube_App/web_server
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
export APP_INTERNAL="http://<APP_SERVER_PRIVATE_IP>:5001"
export WEB_HOST="0.0.0.0"
export WEB_PORT=5000
(Replace <APP_SERVER_PRIVATE_IP> with your Backend instance’s private IP)
nohup python3 app.py > web_server.log 2>&1 &
Open your browser and visit:
http://<PUBLIC_IP_OF_WEB_SERVER>:5000
The Web Server proxies API requests to:
http://<APP_SERVER_PRIVATE_IP>:5001
which connects to:
<DB_SERVER_PRIVATE_IP>:3306
mysql -h <DB_SERVER_PRIVATE_IP> -u appuser -p
curl http://<APP_SERVER_PRIVATE_IP>:5001/api/health
Expected:
{"status": "ok"}
http://<PUBLIC_IP_WEB_SERVER>:5000
You should see the VCube App interface.
NOTE
Make sure the following ports are accessible in your AWS Security Groups or Firewall settings:
Port 5000 → Web Server (Frontend)
Port 5001 → App Server (Flask Backend)
Port 3306 → DB Server (MySQL)
Port 22 → SSH (for remote access to all servers)
These ports must be open for communication between respective servers.
| Component | Example Private/Public IP | Port | Description |
|---|---|---|---|
| Web Server | <public_ip_web> | 5000 | User interface (frontend) |
| App Server | <private_ip_app> | 5001 | Flask API + JWT + Logic |
| DB Server | <private_ip_db> | 3306 | MySQL database |

