Bedrock supports the use of automation tools like Jenkins through its REST API.
This tutorial demonstrates how to orchestrate the deployment of a machine learning service on Bedrock. You will set up a Jenkins pipeline to:
Query the Model Store for new versions of a model
A Bedrock account with an Environment provisioned,
A running Jenkins instance with the HTTP Request plugin,
Some familiarity with Groovy, and
Successfully created an end-to-end ML service on Bedrock using our demonstration project.
After completing the demonstration project, you should have have successfully:
Created and run a Training Pipeline from a remote git repository that you can find by clicking Pipelines on the top menu bar.
Produced a model that you can find by clicking Models on the top menu bar.
Deployed an endpoint backed by a model server that you can find by clicking Endpoints on the top menu bar.
As Jenkins will interact with Bedrock over its REST API, we need to provide Jenkins with the appropriate credentials to authenticate with Bedrock. This is done using a Bedrock Personal API token.
To generate a personal API token, follow the instructions in this guide.
Load your Personal API Token into Jenkins's credential management system by following the instructions here.
To work with the demonstration project, save the API token as a secret text under the name
On the Jenkins web UI, click New item.
In the Enter an item name field, specify the name for your new Pipeline project (e.g. churn-prediction-service).
Select a Pipeline project type, then click OK.
On the next page, scroll down to the Pipeline section.
In the Definition field, choose the Pipeline script from SCM option. This option instructs Jenkins to obtain your Pipeline from a Source Control Management system.
In the SCM field, choose Git.
In the Repository URL field, enter the path of the demonstration project repository
In the Script Path field, enter
jenkins/Jenkinsfile. This is the path to the file Jenkins uses to define a build pipeline.
Click Save to save your new Pipeline project.
This example pipeline does the following:
Runs (simulated) unit tests on the serving code.
Checks if the latest version of the model fulfils certain accuracy, precision and recall requirements. If these requirements are not met, the build is failed.
Deploys the model serving code and latest Model Version to a specified endpoint.
Waits up to 5 minutes for the Model Server to pass Bedrock's health check and become active. If the model does not become active within a set time, the build is failed.
On Jenkins, click Open Blue Ocean on the left panel.
In the This job has not been run message box, click Run. This will open an Input required message box.
In the Model repository field, enter the ID of the Model you want to deploy - e.g.
In the Endpoint field, enter the ID of the of the Endpoint you want to deploy your Model Server and Model to - e.g.
Review the default values in the rest of the fields.
Your deployment pipeline should now be running and may take a few minutes to complete. After it completes, you should see a success report similar to the following.
To avoid incurring additional charges from your cloud service provider, it is important to remove running Model Servers on Bedrock that you no longer need.
On Bedrock, click Endpoints.
Find the endpoint you targeted as part of your deployment pipeline and click on it.
On the endpoint page, click on the Deployed models tab.
Click Undeploy on the models you no longer need.