This repository is a complete guide to MLOps, demonstrating how to take experimental Machine Learning models and deploy them as scalable, production-ready REST APIs using FastAPI, Docker, and Multi-Cloud Infrastructure (AWS, GCP, Azure).
The following diagram illustrates the flow from data storage to the end-user:
graph TD
subgraph Data_Storage ["Cloud Storage (S3 / GCS / Blob)"]
Storage[("Artifact Registry & Data")]
end
subgraph Training_Phase ["Development Environment"]
TS[Training Server / Notebooks] -->|Upload Artifacts| Storage
TS -.->|Models: TinyBERT, ViT| TS
end
subgraph Production_Cloud ["Cloud Compute Cluster (EC2 / Compute Engine / VM)"]
direction TB
subgraph Container_Stack ["Dockerized App"]
NG[Nginx Reverse Proxy] --> FA[FastAPI Server]
FA -->|Load Weights| Storage
FA -->|Inference| ML[ML Models]
end
end
Actor((End User)) -->|REST API / Streamlit| NG
ML -->|JSON Prediction| Actor
style Production_Cloud fill:#f2f4f7,stroke:#232f3e,stroke-width:2px
style Storage fill:#ff9900,color:white
- Cloud Providers: AWS, Google Cloud Platform (GCP), Microsoft Azure
- Python Version: 3.11.8
- AWS SDKs:
boto3(S3, EC2, IAM, ECR, ECS) - GCP SDKs:
google-cloud-storage,google-cloud-compute,google-cloud-artifact-registry,google-cloud-run,google-cloud-iam - Azure SDKs:
azure-identity,azure-storage-blob,azure-mgmt-storage,azure-mgmt-compute,azure-mgmt-network,azure-mgmt-authorization,azure-mgmt-containerregistry - API Framework: FastAPI, Streamlit
- Containerization: Docker, Docker Compose
- Web Server: Nginx (Reverse Proxy)
- Models: TinyBERT (NLP sentiment + disaster classification), Vision Transformer (pose classification)
Theoretical foundations and setup guidelines:
architecture/β Research papers, MLOps concepts, deployment overviewssetup/β SSH, VS Code Remote, IAM roles, Elastic IP configuration guides
| Step | Folder | Description |
|---|---|---|
| 1 | 01-s3-storage-setup/ |
S3 bucket creation, dataset upload |
| 2 | 02-model-training/ |
TinyBERT + ViT training notebooks, push to S3 |
| 3 | 03-ec2-compute-setup/ |
EC2 instance provisioning via boto3 |
| 4 | 04-local-app-development/ |
FastAPI app + Streamlit frontend (local) |
| 5 | 05-deploy-streamlit-ec2/ |
Deploy Streamlit to EC2 |
| 6 | 06-dockerize-app-and-fastapi/ |
FastAPI + Nginx Docker stack |
| 7 | 07-deploy-fastapi-ecs/ |
Push to ECR, deploy to ECS Fargate |
Start with the master notebook: gcp-mlops-complete.ipynb
| Step | Folder | Description |
|---|---|---|
| 1 | 01-gcs-storage-setup/ |
GCS bucket creation, dataset upload |
| 2 | 02-model-training/ |
TinyBERT + ViT training notebooks, push to GCS |
| 3 | 03-gce-compute-setup/ |
GCE instance provisioning via Python SDK |
| 4 | 04-local-app-development/ |
FastAPI app + Streamlit frontend (local) |
| 5 | 05-deploy-streamlit-gce/ |
Deploy Streamlit to GCE |
| 6 | 06-dockerize-app-and-fastapi/ |
FastAPI + Nginx Docker stack |
| 7 | 07-deploy-cloud-run/ |
Push to Artifact Registry, deploy to Cloud Run |
Start with the master notebook: azure-mlops-complete.ipynb
| Step | Folder | Description |
|---|---|---|
| 1 | 01-azure-blob-storage-setup/ |
Storage account + blob container setup |
| 2 | 02-model-training/ |
TinyBERT + ViT training notebooks, push to Azure Blob |
| 3 | 03-azure-vm-setup/ |
Azure VM + NSG provisioning via Python SDK |
| 4 | 04-local-app-development/ |
FastAPI app + Streamlit frontend (local) |
| 5 | 05-deploy-streamlit-vm/ |
Deploy Streamlit to Azure VM |
| 6 | 06-dockerize-app-and-fastapi/ |
FastAPI + Nginx Docker stack |
| 7 | 07-deploy-azure-container-apps/ |
Push to ACR, deploy to Container Apps |
Raw CSV and TSV datasets for model training (IMDB reviews, Twitter sentiment, disaster tweets).
- Python 3.11.8
- Docker and Docker Compose
- Cloud CLI:
aws configure/gcloud auth login/az login
git clone https://github.com/omixec/AWS-multi-models-MLOPS.git
cd AWS-multi-models-MLOPSpython3.11 -m venv venv
source venv/bin/activateInstall only the requirements for the cloud provider you are working with:
# AWS
pip install -r infrastructure/aws/requirements.txt
# GCP
pip install -r infrastructure/gcp/requirements.txt
# Azure
pip install -r infrastructure/azure/requirements.txt
# FastAPI app (local dev)
pip install -r infrastructure/aws/04-local-app-development/fastapi/requirements.txt# GCP
cp infrastructure/gcp/.env.example infrastructure/gcp/.env
# Edit infrastructure/gcp/.env with your project values
# Azure
cp infrastructure/azure/01-azure-blob-storage-setup/.env.example infrastructure/azure/.env
# Edit with your subscription and storage account details# GCP full workflow
jupyter notebook infrastructure/gcp/gcp-mlops-complete.ipynb
# Azure full workflow
jupyter notebook infrastructure/azure/azure-mlops-complete.ipynb# AWS (reference implementation)
cd infrastructure/aws/06-dockerize-app-and-fastapi
docker compose up --build
# API docs: http://localhost/docsAll three clouds follow least-privilege: service identities get only the roles they need, scoped as narrowly as possible.
| Cloud | Identity Type | Scope Strategy |
|---|---|---|
| AWS | IAM Role + Instance Profile | Inline policy with specific S3 bucket ARN; role attached to EC2/ECS task |
| GCP | Service Account | set_iam_policy() on GCS bucket + GAR repo (resource-scoped); roles/run.developer at project level (Cloud Run limitation) |
| Azure | Service Principal (App Registration) | role_assignments.create() scoped to storage account ARM path / resource group / ACR resource |
The repository contains detailed documentation in Markdown format in the docs/ folder:
docs/architecture/MLOps_Architecture.md: General overview of the MLOps lifecycle and system architecture.docs/architecture/ML_Model_Deployment.md: Guide on ML Model deployment types, challenges, and workflows.docs/architecture/ViT_Vision_Transformer.md: Understanding the Vision Transformer architecture behind Pose Classification.docs/architecture/ML_Model_Serving_over_REST_API.md: Details about model serving over REST APIs.docs/architecture/Docker_Overview.md: Deep dive into containerizing ML applications.