Deploying a Custom Docker Model with SageMaker to a Serverless Front-end with S3

Deploying a Custom Docker Model with SageMaker to a Serverless Front-end with S3

How to effectively deploy a model with AWS. Deploying a model with AWS SageMaker is a great way to allow users or customers to interact with it. While you can use the many algorithms and models that come with SageMaker’s Python SDK, there are also many cases where you might want to create your own algorithm. This requires the use of Docker.

The easiest way to let people interact with your model is by employing AWS Lambda and API Gateway to setup an API POST request to the model.

Finally, having an API for sending requests and receiving inference responses from the model is great, but a simple and nice looking web app for users to interact with the data is even better. This is where hosting a static website with S3 and accessing the endpoint with AJAX comes into play.

All of these components of AWS working in unison allows for a sleek development and inference serving framework. This tutorial also covers using AWS CloudWatch to understand ambiguous errors such as 500 Internal Server Errors from the custom model.

Check out the repo for the some of the code mentioned below, here.

Docker Model

To deploy a custom model with SageMaker it must be wrapped by  SageMaker’s Estimator class. This can be done by creating a Docker image that interfaces with this class.

Also, check out this post, if you don’t know what Docker is and why it's so important nowadays.

Install Docker

Install Docker for your respective OS with these links:  Mac,  Ubuntu and  Windows. Windows Home edition is a bit more difficult so I will cover some of the steps here, since Windows is the OS I use. Follow these steps first and see how far you get. Refer to the steps below if you get stuck.

WSL 2 is required in Windows Home edition to run Docker Desktop.

docker sagemaker s3 anomaly-detection aws

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Docker Explained: Docker Architecture | Docker Registries

Following the second video about Docker basics, in this video, I explain Docker architecture and explain the different building blocks of the docker engine; docker client, API, Docker Daemon. I also explain what a docker registry is and I finish the video with a demo explaining and illustrating how to use Docker hub.

Serverless Containers With AWS Fargate and Docker

In AWS there are a few services which seem similar or related when it comes to containerisation. They do have their nuances so let’s begin with an introduction of what these are and their similarities and differences (according to the AWS documentation)

Quick Guide to Dockerized Training in AWS Sagemaker (with Code Example)

A quick & simple guide to using Customized Docker and train your model in AWS Sagemaker! ... post explores a way of bringing your own code and image and quickly set up training in AWS Sagemaker. It comes with an easy-to-follow-along code example ...

What Is S3 In AWS | AWS S3 Tutorial for Beginners

In this video, i will show you what is s3 in aws ,S3 is a simple stroage service with excellent reliability and cost structure. I show you some of the basic ...

ICYMI: From Docker Straight to AWS Built-in

Learn from Docker experts to simplify and advance your app development and management with Docker. Stay up to date on Docker events and new version announcements!