Create endpoint from Python

0

Hello,

I have trained my model on sagemaker. I have deleted the endpoint, but I am keeping the model and the endpoint configuration which points to the model.

From the sagemaker dashboard I am able to recreate the endpoint using the existing endpoint configuration. However I don't want to keep the endpoint on all the time, as I will use it only once a day for a few minutes.

Is it possible to create in on demand from a Python script? I would assume that it is possible, but can't find how. Can someone point me in the right direction?

Regards.

demandé il y a 3 ans313 vues
2 réponses
0

Thanks Chaitanya,

I was able to create the endpoint using the "create_endpoint" method and following one of the links provided.

def create_endpoint(endpoint_name, config_name):
    """ Create SageMaker endpoint with input endpoint configuration.
    Args:
        endpoint_name (string): Name of endpoint to create.
        config_name (string): Name of endpoint configuration to create endpoint with.
    Returns:
        (None)
    """
    try:
        sagemaker.create_endpoint(
            EndpointName=endpoint_name,
            EndpointConfigName=config_name
        )
    except Exception as e:
        print(e)
        print('Unable to create endpoint.')
        raise(e)

name = 'name-of-the-endpoint'
config = 'name-of-the-endpoint-config' #this one has to exist on the Endpoint configuration list on sagemaker
create_endpoint(name, config)

Regards

Edited by: hugoflores on Aug 17, 2021 9:36 AM

répondu il y a 3 ans

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions