Skip to content

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

Use DataRobot Prime models with AWS Lambda

Availability information

The ability to create new DataRobot Prime models has been removed from the application. This does not affect existing Prime models or deployments. To export Python code in the future, use the Python Scoring Code export function in any RuleFit model.

This page outlines how you can use the DataRobot Prime model functionality to download a DataRobot model and deploy it using AWS Lambda.

DataRobot Prime can be initiated on most DataRobot models and allows you to download an approximation of a DataRobot model either as a Python or Java module. The code is then easily deployable in any environment and is not dependent on the DataRobot application. Before proceeding with this workflow, be sure to download a DataRobot Prime model as a Java module.

Why deploy on AWS Lambda

While DataRobot provides its own scalable prediction servers that are fully integrated with the platform, there are multiple reasons why you would want to deploy on AWS Lambda:

  • Company policy or governance decision.

  • Serverless architecture.

  • Cost reduction.

  • Custom functionality on top of the DataRobot model.

  • The ability to integrate models into systems that cannot communicate with the DataRobot API.

Setup

Follow the steps below to complete setup for this example.

  1. Rename the Java file to Prediction.java.

  2. Create a project, “lambda_prime_example”, in the IDE of your choice.

  3. Copy Prediction.java to the project.

  4. Compile the package using the mvn package command.

  5. Click Create function to create a new AWS function.

  6. Choose Java 11 to create Lambda.

  7. Give the function a name and choose the permissions.

  8. Upload the compiled JAR file to Lambda.

  9. Change the Lambda handler to the name of the Java package method:

    com.datarobot.examples.scoring.prime.PrimeLambdaExample::handleRequest
    

Setup is now complete. Next, perform testing to verify that the deployment is working as intended.

Test the Lambda function

To test the Lambda function:

  1. Go to the TEST event configuration page.

  2. Put JSON with features as test event:

  3. Click the Test button.

Now, you can configure the integration with an AWS API Gateway or other services so that data is sent to the Lambda function and you receive results back.


Updated May 11, 2023