# Automated deployment and replacement in Sagemaker
URL: https://docs.datarobot.com/en/docs/classic-ui/mlops/deployment/prediction-env/pred-env-integrations/sagemaker-cm-deploy-replace.html

> Create a DataRobot-managed Sagemaker prediction environment to deploy and replace DataRobot custom models and Scoring Code in Sagemaker.

# Automated deployment and replacement in Sagemaker

> [!NOTE] Premium
> Automated deployment and replacement of custom models and Scoring Code in Sagemaker is a premium feature. 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 ( Premium feature)

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.

> [!NOTE] Service health information for external models and monitoring jobs
> Service health information is unavailable for external [agent-monitored deployments](https://docs.datarobot.com/en/docs/classic-ui/mlops/deployment/mlops-agent/monitoring-agent/index.html) and deployments with predictions uploaded through a [prediction monitoring job](https://docs.datarobot.com/en/docs/classic-ui/predictions/batch/pred-monitoring-jobs/index.html).

## Create a Sagemaker prediction environment

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

1. ClickDeployments > Prediction Environmentsand then clickAdd prediction environment.
2. In theAdd prediction environmentdialog box, configure the prediction environment settings:
3. After configuring the environment settings, clickAdd environment. The Sagemaker environment is now available from thePrediction Environmentspage.

## Deploy a model to the Sagemaker prediction environment

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

1. ClickModel Registry > Registered Modelsand select either the custom model or the Scoring Code enabled model you want to deploy to the Sagemaker prediction environment. TipYou can also deploy a model to your Sagemaker prediction environment from theDeployments > Prediction Environmentstab by clicking+ Add new deploymentin the prediction environment.
2. On any tab in the registered model version, clickDeploy.
3. In theSelect Deployment Targetdialog box, underSelect deploy target, clickSagemaker.
4. UnderSelect prediction environment, select the Sagemaker prediction environment you previously configured, and then clickConfirm.
5. Configure the deployment. When deploying to Sagemaker prediction environments, you must specify theReal-time inference instance typeandInitial instance countfields. When deployment configuration is complete, clickDeploy model.
6. Once the model is deployed to Sagemaker, you can use theScore your datacode snippet from thePredictions > Portable Predictionstab 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. ClickDeployments > Prediction Environmentspage, and then select the Sagemaker prediction environment from the list.
2. Below the prediction environment settings, underService Account, clickRestart Environment.

---
