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.

已提问 3 年前331 查看次数
2 回答
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

已回答 3 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则