A real-time system resource monitoring application built with Flask and Python, containerized with Docker, and deployed on AWS EKS using Kubernetes.
This project implements a resource monitoring web application that collects real-time CPU and memory statistics and visualizes them on a web dashboard. Built with modern cloud technologies, it demonstrates containerization, orchestration, and AWS cloud deployment.
- Frontend: HTML, CSS
- Backend: Python, Flask, Flask-SocketIO
- Containerization: Docker
- Cloud Platform: AWS (ECR, EKS)
- Orchestration: Kubernetes
- Automation: Boto3, Kubernetes Python Client
CLOUD_NATIVE_MONITORING_APP/
├── templates/ # HTML UI templates
│ └── index.html
├── app.py # Flask application
├── ecr.py # AWS ECR automation script
├── eks.py # AWS EKS automation script
├── Dockerfile # Docker configuration
└── requirements.txt # Python dependencies
- Real-time CPU & memory usage monitoring
- WebSocket-based data streaming
- Containerized deployment
- Secure and scalable hosting via AWS EKS
- Automated cloud provisioning
- AWS Account with programmatic access
- Python 3 installed
- Docker installed
- kubectl installed
- Code editor (VSCode recommended)
-
Clone the repository
git clone <repository_url> cd <project_folder>
-
Install dependencies
pip install -r requirements.txt
-
Run the application
python app.py
Access the dashboard at http://localhost:5000/
-
Build the Docker image
docker build -t monitoring-app . -
Run the Docker container
docker run -p 5000:5000 monitoring-app
Access at http://localhost:5000/
-
Create ECR repository
# Using ecr.py script import boto3 ecr_client = boto3.client('ecr') repository_name = 'monitoring-app-repo' response = ecr_client.create_repository(repositoryName=repository_name) repository_uri = response['repository']['repositoryUri'] print(f"Repository URI: {repository_uri}")
-
Push to ECR
# Authenticate Docker to ECR aws ecr get-login-password --region <region> | docker login --username AWS --password-stdin <repository_uri> # Tag and push docker tag monitoring-app:latest <repository_uri>:latest docker push <repository_uri>:latest
-
Create EKS cluster
# Use AWS Console or eks.py script to create cluster and node group -
Deploy the application
# Using the Kubernetes Python client from kubernetes import client, config config.load_kube_config() api_client = client.ApiClient() # Create deployment deployment = client.V1Deployment( metadata=client.V1ObjectMeta(name="monitoring-app"), spec=client.V1DeploymentSpec( replicas=1, selector=client.V1LabelSelector(match_labels={"app": "monitoring-app"}), template=client.V1PodTemplateSpec( metadata=client.V1ObjectMeta(labels={"app": "monitoring-app"}), spec=client.V1PodSpec(containers=[ client.V1Container( name="monitoring-container", image="<repository_uri>:latest", ports=[client.V1ContainerPort(container_port=5000)] ) ]) ) ) ) apps_v1 = client.AppsV1Api(api_client) apps_v1.create_namespaced_deployment(namespace="default", body=deployment) # Create service service = client.V1Service( metadata=client.V1ObjectMeta(name="monitoring-service"), spec=client.V1ServiceSpec( selector={"app": "monitoring-app"}, ports=[client.V1ServicePort(port=5000, target_port=5000)], type="LoadBalancer" ) ) core_v1 = client.CoreV1Api(api_client) core_v1.create_namespaced_service(namespace="default", body=service)
-
Verify the deployment
kubectl get deployment -n default kubectl get service -n default kubectl get pods -n default
-
Access the application
# For testing, you can use port-forwarding kubectl port-forward service/monitoring-service 5000:5000 # For production, access via the LoadBalancer URL kubectl get service monitoring-service -o jsonpath='{.status.loadBalancer.ingress[0].hostname}'
This project is licensed under the MIT License.