Giter Club home page Giter Club logo

ecs-mxnet-example's Introduction

Deploy a MXNet predict function to Amazon ECS using CodeCommit and CodePipeline

This project will create an automated workflow that will provision, configure and orchestrate a pipeline triggering deployment of any changes to your mxnet model or application code. You will orchestrate all of the changes into a deployment pipeline to achieve continuous delivery using CodePipeline and CodeBuild. You can deploy new MXNet APIs and make those available to your users in just minutes, not days or weeks.

Required:

Prepare an AWS Account
If you don’t already have an AWS account, create one at http://aws.amazon.com by following the on-screen instructions.

Please launch in N.Virginia

Create a CodeCommit repository and Connect with this repository

  1. Clone this github repository

    git clone https://github.com/awslabs/ecs-mxnet-example.git
    
  2. Go to AWS Console and select CodeCommit. Click Create New repository button. Enter a unique repository name( e.g. image-classification-predict ) and a description and click Create repository.

    You will get a URL to your CodeCommit repository similar to https://git-codecommit.us-east-1.amazonaws.com/v1/repos/image-classification-predict

  3. You can use https or ssh to connect to your CodeCommit repository. We’ll connect via SSH in this lab.
    Follow instructions from here: http://docs.aws.amazon.com/codecommit/latest/userguide/setting-up-gc.html?icmpid=docs_acc_console_connect

Commit the Source Code and Configuration files into your CodeCommit repository

  1. Clone a local copy of CodeCommit repo ( we recommend: you created earlier in your home directory.

     cd ~
     git clone <your repo url from above> 
    

    This will create a folder as the same name as in your path where you executed the git clone command.

  2. Copy the contents of directory into this new folder.

     cp -r ecs-mxnet-example/image-classification-predict/ image-classification-predict/
    
  3. Change the buildspec.yml file to include your AWS account number.

     <your account number>.dkr.ecr.us-east-1.amazonaws.com/image-classification-predict:latest
    
  4. Commit all of the copied contents into your CodeCommit repository.

    git add --all
    git commit -m "Initial Commit"
    git push origin master  
    

Tip: Verify the file .git/config for remote==”origin” and branch==”master”

Deploy via CloudFormation template.

  1. Run the Cloudformation template provided
    1. Go to AWS Console
    2. Click on Services
    3. Click on Cloudformation
    4. Create a new stack
    5. Enter the url https://s3.amazonaws.com/mxnet-template-cicd-feb27/master.yaml in the Specify an Amazon S3 template URL section
    6. Follow the steps with default parameters.
    7. Review the details
    8. Click create.

It takes 10 minutes to deploy the complete stack.

The Cloud Formation template creates a ECS cluster in a VPC and deploys the application code alongwith the needed dependencies. It also adds Cloud Watch for logging and performance monitoring and autoscaling alongwith an Application Load Balancer.

The development workflow is preconstructed with the CICD pipeline to ensure the application development and model training workflows are integrated.

Test using a Rest Client.

You can get the MLServiceUrl from the Cloudformation Output for the master stack.

GET http://<MLServiceUrl>/image?image=<image_url>

an example url to use:

https://upload.wikimedia.org/wikipedia/commons/thumb/5/5b/Golden_Gate_Bridge,_San_Francisco,_California_LCCN2013633353.tif/lossy-page1-450px-Golden_Gate_Bridge,_San_Francisco,_California_LCCN2013633353.tif.jpg

The API predicts that theimage is a suspension bridge with 62% probability.

Cleanup

  • Reset Steps

    1. Delete the ECR Repository
    2. Delete the CloudFormation stack and re-create it.
  • Removal Steps

    1. Delete the ECR Repository
    2. Delete the CloudFormation stack.

ecs-mxnet-example's People

Contributors

bchauras avatar jbnunn avatar jpeddicord avatar zachahuy01 avatar

Watchers

 avatar  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.