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년 전325회 조회
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년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠