Skip to content

On-premise users: click in-app to access the full platform documentation for your version of DataRobot.

Automated deployment and replacement in Sagemaker

Availability information

Automated deployment and replacement of custom models and Scoring Code in Sagemaker is off by default. Contact your DataRobot representative or administrator for information on enabling this feature.

Feature flag: Enable the Automated Deployment and Replacement of custom models in Sagemaker

Now available for preview, you can create a DataRobot-managed Sagemaker prediction environment to deploy custom models and Scoring Code in Sagemaker with real-time inference and serverless inference. With DataRobot management enabled, the external Sagemaker deployment has access to MLOps management, including automatic model replacement.

Create a Sagemaker prediction environment

To deploy a model in Sagemaker, first create a custom Sagemaker prediction environment:

  1. Click Deployments > Prediction Environments and then click Add prediction environment.

  2. In the Add prediction environment dialog box, configure the prediction environment settings:

    • Enter a descriptive Name and an optional Description of the prediction environment.

    • Select Amazon Web Services from the Platform dropdown.

    • Enable the Managed by DataRobot setting to allow this prediction environment to automatically package and deploy DataRobot custom and Scoring Code models through the Management Agent.


      DataRobot management of Scoring Code in Sagemaker requires an existing data connection to Sagemaker with stored credentials. If you don't have an existing Sagemaker data connection, the No Data Connections found alert appears, directing you to go to your data connections to create a Sagemaker connection.

    • Select the related AWS Credentials and specify a Region. Once provided, DataRobot automatically fetches the available roles.

    • Configure the Sagemaker roles for the prediction environment. Reference the Sagemaker documentation to configure the IAM execution role. The execution role must have the following Amazon SQS permissions:

      • "sqs:SendMessage"
      • "sqs:GetQueueUrl"
      • "sqs:GetQueueAttributes"
      • "sqs:ListQueues"
    • The AWS CodeBuild service role is required so that CodeBuild can build model images. Create a CodeBuild service role by using the CodeBuild or AWS CodePipeline consoles (to do so, reference the AWS documentation. The CodeBuild service role must have the following Amazon SQS permissions:

      • "ecr:ListImages"
      • "iam:GetRole"
      • "iam:PassRole"
      • "sts:AssumeRole"
    • Reference the AWS documentation for creating an ECR Repository.

    • Reference the AWS documentation for creating an ECR Repository Cache for Docker Hub.

  3. After configuring the environment settings, click Add environment.

    The Sagemaker environment is now available from the Prediction Environments page.

Deploy a model to the Sagemaker prediction environment

Once you've created a Sagemaker prediction environment, you can deploy a model to it:

  1. Click Model Registry > Registered Models and select either the custom model or the Scoring Code enabled model you want to deploy to the Sagemaker prediction environment.


    You can also deploy a model to your Sagemaker prediction environment from the Deployments > Prediction Environments tab by clicking + Add new deployment in the prediction environment.

  2. On any tab in the registered model version, click Deploy.

  3. In the Select Deployment Target dialog box, under Select deploy target, click Sagemaker.

  4. Under Select prediction environment, select the Sagemaker prediction environment you previously configured, and then click Confirm.

  5. Configure the deployment. When deploying to Sagemaker prediction environments, you must specify the Real-time inference instance type and Initial instance count fields. When deployment configuration is complete, click Deploy model.

  6. Once the model is deployed to Sagemaker, you can use the Score your data code snippet from the Predictions > Portable Predictions tab to score data in Sagemaker.

Restart a Sagemaker prediction environment

When you update database settings or credentials for the Sagemaker data connection used by the prediction environment, you can restart the environment to apply those changes to the environment:

  1. Click Deployments > Prediction Environments page, and then select the Sagemaker prediction environment from the list.

  2. Below the prediction environment settings, under Service Account, click Restart Environment.

Updated May 16, 2024