Skip to content

Instantly share code, notes, and snippets.

@Steboss89
Created September 18, 2022 21:47
Show Gist options
  • Save Steboss89/44fbc01c78fe7daa46e21d7d8876c868 to your computer and use it in GitHub Desktop.
Save Steboss89/44fbc01c78fe7daa46e21d7d8876c868 to your computer and use it in GitHub Desktop.
Deploy to a SageMaker endpoint
import mlflow
import os
# PARSE YOUR MLFLOW INFO
# image build and push by mlflow
image_uri = "230178520806.dkr.ecr.eu-west-1.amazonaws.com/mlflow-pyfunc:1.28.0"
# the model uri
model_uri = "models:/SageMaker1/Staging"
# your region
region = "eu-west-1"
# the arn of the sagemaker deployment role
arn = "arn:aws:iam::230178520806:role/awssagemakerdeployment"
# deploy to the endpoint
mlflow.sagemaker.deploy(
mode='create',
app_name="NaiveBayesTest",
model_uri=model_uri,
image_url=image_uri,
execution_role_arn=arn,
instance_type="ml.t2.medium",
instance_count=1,
region_name=region
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment