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年前332ビュー
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年前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ