In this video, you’ll see how to automate machine learning operations (MLOps) with SageMaker projects.
With this capability, you can enable faster model training and deployment,
apply DevOps practices to the machine learning (ML) ecosystem, and standardize governance practices in ML projects.
To get started, let’s create a project in Amazon SageMaker Studio.
We’ll use the first project template from this list.
Let’s take a quick look at the high-level architecture for this template.
This template essentially uses Jenkins as the orchestrater,
and SageMaker pipelines for automating the entire Machine Learning life cycle.
Let’s provide a name and description for the project.
Next, we’ll provide the URL of the GitHub repository we’re using for our model build code.
Let’s provide the name of the repository.
Now we’ll specify the Codestar Connection ARN,
which can be found in AWS Developer Tools under Settings.
Next, we’ll go through the same process for our model deploy code repository.
Let’s create the project.
The project has been created.
Our two repositories are listed but there are currently no pipelines, experiments, model groups,
or endpoints associated with this SageMaker project.
Next, let’s go to Jenkins, our orchestrator, to create the build pipeline using the DSL generated in the seed code created through this project.
For the purposes of this example, we have already set up the project to create the build pipeline.
Let’s review its configuration.
As you can see, this project uses our AWS credentials, repository URL,
GitHub credentials, and the Job DSL API.
If we return to SageMaker,
we can see that SageMaker has seeded the build repository with this layout.
The jenkins folder contains a Jenkins file, as well as a seed job, that has been seeded by SageMaker.
Let’s take a closer look at the Jenkins file.
Next, let’s drill down into the seeded job.
The same process has also occurred in the deploy repository.
Let’s refresh the view.
Notice that the repository has been populated with seed code.
As in the build repository, we have a Jenkins file and a seeded job.
We can see here that this job is integrated with SageMaker.
Let’s return to Jenkins, save the project, and build the pipeline.
Let’s take a look at the console output for this build.
As you can see, the build failed because the script is not yet approved for use.
Let’s fix this.
Notice that one script is pending approval.
We’ll approve the script.
Now that the script has been approved, let’s return to the project and re-run our build.
This time the build succeeded and generated a Jenkins pipeline.
There’s no data yet, as the pipeline has not yet run.
Let’s wait for it to finish running.
The Jenkins Pipeline build has completed.
Let’s return to SageMaker to find it there.
Here’s the new build pipeline.
Next, let’s go back to Jenkins and repeat the process to create the deploy pipeline.
For the purposes of this demonstration, we'll skip ahead to when the deploy pipeline is created.
The project has been built successfully.
Here’s the model deploy pipeline, which is currently running.
Let’s wait for it to finish.
This build failed as well.
Let’s review the console output to find out why.
This build failed because no approved ModelPackage was found for the ModelPackageGroup.
We can fix this by approving a model in SageMaker.
Notice that Model 1 is pending.
Let’s update its status to “Approved.”
Now let’s return to Jenkins and try building the deploy pipeline again.
The SageMaker deploy pipeline has been created.
Let’s delete the build that failed.
The SageMaker deploy pipeline has been generated for us and is starting up.
The deployment from “staging” to “production environment” requires a manual approval.
Before we approve, let’s go to the SageMaker console and take a look at the endpoints.
Here we can see an endpoint that is now “InService.”
There’s no production endpoint because we haven’t approved it yet.
Let’s find this endpoint in SageMaker Studio.
The staging endpoint is also “InService” here.
Let’s go back to Jenkins to provide manual approval for the product.
The production endpoint will be created shortly.
Now that the production deployment has completed, let’s check in on the endpoints again.
We now have a production endpoint that is “InService.”
Let’s check SageMaker Studio.
The production endpoint is “Inservice” here as well.
The pipeline is now complete for both build and deployment, and we also seamlessly integrated Jenkins as an orchestrator.
In our example, we used a pre-built template.
You can also use organizational templates for your projects.
These templates are supported by AWS Service Catalog.
You’ve just seen how to automate MLOps with SageMaker projects.
You can learn more about this topic in the description and links for this video.
Thanks for watching. Now it’s your turn to try.