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.

gefragt vor 3 Jahren332 Aufrufe
2 Antworten
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

beantwortet vor 3 Jahren

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen