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.
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
-
Clone this github repository
git clone https://github.com/awslabs/ecs-mxnet-example.git
-
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
-
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
-
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.
-
Copy the contents of directory into this new folder.
cp -r ecs-mxnet-example/image-classification-predict/ image-classification-predict/
-
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
-
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”
- Run the Cloudformation template provided
- Go to AWS Console
- Click on Services
- Click on Cloudformation
- Create a new stack
- Enter the url https://s3.amazonaws.com/mxnet-template-cicd-feb27/master.yaml in the Specify an Amazon S3 template URL section
- Follow the steps with default parameters.
- Review the details
- 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.
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.
-
Reset Steps
- Delete the ECR Repository
- Delete the CloudFormation stack and re-create it.
-
Removal Steps
- Delete the ECR Repository
- Delete the CloudFormation stack.