Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I deploy a re-trained Sagemaker model to an endpoint?

With an sagemaker.estimator.Estimator, I want to re-deploy a model after retraining (calling fit with new data).

When I call this

estimator.deploy(initial_instance_count=1, instance_type='ml.m5.xlarge')

I get an error

botocore.exceptions.ClientError: An error occurred (ValidationException) 
when calling the CreateEndpoint operation: 
Cannot create already existing endpoint "arn:aws:sagemaker:eu-east- 
1:1776401913911:endpoint/zyx".

Apparently I want to use functionality like UpdateEndpoint. How do I access that functionality from this API?

like image 306
Joshua Fox Avatar asked Sep 02 '25 07:09

Joshua Fox


1 Answers

Yes, under the hood the model.deploy creates a model, an endpoint configuration and an endpoint. When you call again the method from an already-deployed, trained estimator it will create an error because a similarly-configured endpoint is already deployed. What I encourage you to try:

  • use the update_endpoint=True parameter. From the SageMaker SDK doc: "Additionally, it is possible to deploy a different endpoint configuration, which links to your model, to an already existing SageMaker endpoint. This can be done by specifying the existing endpoint name for the endpoint_name parameter along with the update_endpoint parameter as True within your deploy() call."

  • Alternatively, if you want to create a separate model you can specify a new model_name in your deploy

like image 186
Olivier Cruchant Avatar answered Sep 04 '25 21:09

Olivier Cruchant