A production-ready system monitoring application built with Python/Flask, containerized with Docker, deployed on Amazon EKS with Horizontal Pod Autoscaling, and integrated with Prometheus for observability. Demonstrates a complete cloud-native workflow from local development to production deployment.
[ Flask App (psutil metrics) ]
β
βΌ
[ Docker Container ]
β
βΌ
[ Amazon ECR Registry ]
β
βΌ
[ Amazon EKS Cluster (us-east-1) ]
βββ deployment.yaml β Pod management
βββ service.yaml β LoadBalancer exposure
βββ hpa.yaml β Horizontal Pod Autoscaling
βββ servicemonitor.yaml β Prometheus scraping
- Real-time system metrics β CPU, memory, and disk usage via
psutil, visualized with Plotly - Horizontal Pod Autoscaling β Kubernetes HPA automatically scales pods under traffic load, maintaining 99.9% uptime during simulated spikes
- Prometheus-ready β
servicemonitor.yamlexposes/metricsendpoint for scraping by a Prometheus stack - Programmatic infrastructure β
ecr.pyandeks.pymanage the full container lifecycle via AWS and Kubernetes Python SDKs - Secure credential handling β AWS Account ID and region managed via environment variables (no hardcoded secrets)
| Layer | Technology |
|---|---|
| Backend | Python 3.10+, Flask, psutil, Plotly |
| Containerization | Docker |
| Container Registry | Amazon ECR |
| Orchestration | Kubernetes on Amazon EKS |
| Autoscaling | Kubernetes HPA |
| Observability | Prometheus (ServiceMonitor) |
| IaC / Scripting | Python (boto3, kubernetes SDK) |
| Security | Environment variables, .gitignore for secrets |
cloud-native-monitoring-app/
βββ app.py # Flask app β serves metrics dashboard UI
βββ main.py # Entry point
βββ ecr.py # Creates ECR repo & pushes Docker image
βββ eks.py # Programmatically deploys to EKS cluster
βββ Dockerfile # Container build config
βββ requirements.txt # Python dependencies
βββ deployment.yaml # K8s Deployment manifest
βββ service.yaml # K8s LoadBalancer Service
βββ hpa.yaml # Horizontal Pod Autoscaler config
βββ servicemonitor.yaml # Prometheus ServiceMonitor for scraping
βββ get_helm.sh # Helm installation script
βββ screenshots/ # Deployment verification evidence
- AWS CLI configured (
aws configure) - Docker installed and running
kubectlconnected to your EKS cluster- Python 3.10+
git clone https://github.com/KhushiKachhawaha14/cloud-native-monitoring-app.git
cd cloud-native-monitoring-app
pip install -r requirements.txtexport AWS_ACCOUNT_ID=<your-account-id>
export AWS_REGION=us-east-1python ecr.pyThis will:
- Create an ECR private repository (if not exists)
- Build and tag the Docker image
- Push the versioned image to ECR
python eks.pyThis will:
- Apply the Kubernetes Deployment
- Expose the app via a LoadBalancer Service
- Configure HPA for autoscaling
# Check pods are running
kubectl get pods
# Get the external LoadBalancer URL
kubectl get svc
# Check autoscaler status
kubectl get hpaExpected output:
NAME READY STATUS RESTARTS AGE
cloud-monitor-xxxxxxx-xxxxx 1/1 Running 0 2m
The cloud-native-cluster was provisioned and confirmed active in us-east-1. Container image successfully stored in Amazon ECR private repository.
See
/screenshotsfolder for full deployment verification.
Horizontal Pod Autoscaler scaled pods automatically during simulated traffic β maintaining 99.9% uptime with zero manual intervention.
- AWS Account ID and region loaded from environment variables β never hardcoded
.gitignoreexcludes.env, credentials, and__pycache__- Gitleaks integrated via GitHub Actions to scan for accidental secret commits (
.github/workflows/gitleaks.yml)
The servicemonitor.yaml configures Prometheus to scrape the Flask app's /metrics endpoint. To enable full observability:
# Apply the ServiceMonitor (requires Prometheus Operator in cluster)
kubectl apply -f servicemonitor.yamlFor a complete monitoring stack, see the companion project: Self-Healing Infrastructure
- Add Grafana dashboard for EKS pod metrics
- Implement Helm chart for cleaner deployment packaging
- Add GitHub Actions CI/CD to auto-build and push on every commit
- Add NGINX Ingress Controller instead of raw LoadBalancer
- Implement Dead Letter Queue for failed pod alert handling