Git Product home page Git Product logo

house-price-ml-eks's Introduction

AnalyticsEnthusiast

Deploying a machine learning API in EKS on AWS

Introduction

This project involves the operationalization of a House price prediction API. It uses a sklearn model to predict house prices in Boston according to several features, such as average rooms in a home, highway access and teacher-to-pupil ratios etc. The application has been designed to run in a kubernetes environment to take advantage of auto scaling using replica sets and achieving high availability of the application. Elastic kubernetes service (EKS) on AWS was selected as the platform on which to run to reduce the costs and admin overhead associated with a self hosted Kubernetes cluster.

A blue/green deployment strategy was used to ensure that end users experience no downtime during new releases. Build pipelines are run on circleci to minimise administration overhead associated with managing self hosted build servers such as Jenkins. Additional documentation on architecture and design can be found in the sections below.

High Level Architecture


Project files

Filename Description
.circleci/ Circle CI directory containing job workflow pipeline
cluster_config/eks-cluster.yml yaml file cluster details for eksctl
deployment/ml-deployment.yml yaml file with kubernetes deployment details
deployment/ml-service.yml yaml file with kubernetes service details
deployment/ml-namespace.yml yaml file with namespace details
docs/ Extra documentation stored here
images/ Images used in documentation stored here
model_data/ Binary file/data for trained housing ML model
screenshots/ Project screenshots
testing/make_prediction.sh Contains script for testing ML api endpoint
.gitignore Files to ignore for git
app.py Main Flask API application
Dockerfile Dockerfile of API
get_latest_tag.sh Script for getting latest tag from Dockerhub
Makefile makefile with bootstrap commands for lint and test
README.md README file for the project
requirements.txt Python package Dependencies required to run the API

Project Setup

To get started with this project an EKS cluster must be created in AWS with an initial deployment. For this project "eksctl" will be used to create the cluster, then "kubectl" will be used to create the application namespace and initial deployment/service. As a prerequisite, you must have an IAM with necessary permissions to create an EKS cluster in AWS. I have created a EKSAdmin profile with the required permissions. Assuming you have cloned this repository, run the following commands.


Spin up an eks cluster by running eksctl from the root directory. (This command can take about 15min to complete!)

> eksctl create cluster -f cluster_config/eks-cluster.yml --profile EKSAdmin

Create the application namespace using kubectl to provide a logical grouping.

> kubectl apply -f deployment/ml-namespace.yml

Deploy application to EKS (envsubst is used to substitute parameters into config).

> envsubst < deployment/ml-deployment.yml | kubectl apply -f -

Deploy service to EKS (This will act as the load balancer for the application).

> envsubst < deployment/ml-service.yml | kubectl apply -f -

The load balancer will generate an endpoint like so "xxxxxxxxxxxxxxxxxxx-891722211.us-east-1.elb.amazonaws.com". Visiting your endpoint over HTTP you should see something like below.

Working Application

Index

  1. Architecture

  2. CI/CD Pipeline

house-price-ml-eks's People

Contributors

thelinuxenthusiast avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.