🧠 Overview
- ⚙️ EC2 – to host my Python (Flask) backend
- 🎨 S3 – to serve my React (or HTML/JS) frontend as a static website
- 🗄️ RDS (MySQL) – as a managed cloud database
Project Structure:
Task-Manager-RDS/
├── backend/
│ ├── app.py
│ ├── schema.sql
│ └── requirements.txt
└── frontend/
└── index.html (or React build)
🛠️ 1. Setting Up the Backend on EC2
Step 1: Launch an EC2 Instance
- OS: Ubuntu 24.04 LTS
- Instance Type: t2.micro (Free Tier)
- Enable HTTP, HTTPS, and SSH in the Security Group
- Generate and download a .pem key pair
Step 2: Connect via SSH
-
ssh -i key.pem ubuntu@<your-ec2-public-ip>
- Refer my blogs to connect EC2 with SSH if needed.
Step 3: Setup Python Environment and Clone Our Repo
- Setting up Venv:
sudo apt update
sudo apt install python3-pip python3-venv
python3 -m venv taskman
source taskman/bin/activate
- Clone Repo:
git clone https://github.com/<your-username>/Task-Manager-RDS.git
cd Task-Manager-RDS/backend
pip install -r requirements.txt
Step 4: Start the Flask Server
python3 app.py
- Now the backend is running on
http://<EC2-IP>:5000
☁️ 2. Deploying MySQL with Amazon RDS
Step 1: Create an RDS MySQL DB
- Engine: MySQL
- Public Access: Yes (for now, for testing)
- Security Group: Add EC2 instance's IP for port 3306
Step 2: Connect to RDS from EC2
mysql -h <rds-endpoint> -u <username> -p
Step 3: Create DB & Table
CREATE DATABASE IF NOT EXISTS taskmandb;
USE taskmandb;
CREATE TABLE IF NOT EXISTS tasks (
id INT AUTO_INCREMENT PRIMARY KEY,
title VARCHAR(255) NOT NULL,
status VARCHAR(20) DEFAULT 'pending',
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
- Now, our backend-EC2 connects directly to the RDS DB.
🌐 3. Hosting Frontend on S3
Step 1: Create S3 Bucket
- Name: taskman-frontend-ak
- Region: us-east-1
- Enable: Static website hosting
- Index Document: index.html
Step 2: Upload Frontend Files
aws s3 sync ./frontend s3://taskman-frontend-ak
or upload via Console.
Step 3: Make S3 Bucket Public
- Uncheck Block All Public Access
- Add this Bucket Policy:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "PublicReadGetObject",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::taskman-frontend-ak/*"
}
]
}
Step 4: Access the Site
- open in browser:http://S3websitesendpoint.com
- Now our frontend is live and fetching backend data from the EC2 API!
Check the images weather all are working in correct manner:
- Database Table Verification:
- POST and GET and health Check of Backend:
Main Things to be changed after creating the resources:
- RDS - credentials in app.py
- EC2 Public ip in script.js
- Schema should be created in an organized manner.
Tips to avoid Charges:
- Delete the resources atonce our work is done.
- Focus more on main services like EC2 , VPC and S3.
- Set up a billing alert and budget planing in billing and Cost dashboard.
📣Stay tuned for more Blogs and deployments.
Top comments (1)
@akashabish , the full stack deployment blog is insightful
Some comments may only be visible to logged-in visitors. Sign in to view all comments.