In this article, I’ll walk through how I built and deployed a containerized Message Board Web Application using Python Flask and MySQL on AWS EC2. This project helped me gain hands-on experience with Docker, cloud deployment, and backend development.
📌 Project Overview
The application is a simple message board where users can:
- Add messages
- Delete messages
- Store data in a MySQL database
Both the application and database are containerized using Docker and communicate over a shared network.
🛠️ Tech Stack
- Python
- Flask
- MySQL
- Docker
- AWS EC2
- Linux
🏗️ Architecture
The project consists of two main containers:
- Flask Application Container
- MySQL Database Container
These containers are connected via a custom Docker network:
message-network
The Flask app connects to MySQL using the container name (mysql-db) as the hostname.
⚙️ Step-by-Step Implementation
1️⃣ Create Docker Network
docker network create message-network
2️⃣ Run MySQL Container
docker run -d \
--name mysql-db \
--network message-network \
-e MYSQL_ROOT_PASSWORD=root \
-e MYSQL_DATABASE=messagedb \
mysql:8
3️⃣ Build Flask App Image
docker build -t flask-message-app .
4️⃣ Run Flask Container
docker run -d \
-p 5001:5001 \
--network message-network \
--name flask-app \
flask-message-app
🌐 Deployment on AWS EC2
I deployed this project on an AWS EC2 instance by:
- Launching a Linux-based EC2 instance
- Installing Docker
- Running both containers inside the instance
- Configuring the Security Group to allow inbound traffic on port 5001
🔗 Live Demo
📷 Screenshots
- Web Application UI
- Mobile View
- Running Docker Containers
- MySQL Database Table
📚 Key Learnings
- Understanding Docker containerization
- Managing multi-container applications
- Setting up Docker networks for communication
- Deploying applications on AWS EC2
- Troubleshooting real-world issues
🚀 Future Improvements
- Add message timestamps
- Implement edit functionality
- Use Docker Compose
- Add Nginx reverse proxy
- Set up CI/CD pipeline
🔗 GitHub Repository
👉 https://github.com/Avinash8600/containerized-flask-message-app
👨💻 About Me
I’m a Software Engineer with a focus on Cloud and DevOps, passionate about building and deploying scalable applications.
💬 Conclusion
This project was a great hands-on experience in combining backend development with cloud and containerization technologies. It helped me understand how real-world applications are deployed and managed.
If you have any feedback or suggestions, feel free to share!




Top comments (0)