SageMaker Studio Lab access deployed model via lambda function

0

I am following this Access_AWS_from_Studio_Lab_Deployment.ipynb notebook to deploy a pretrained model in SageMaker Studio lab. For my development I already have a few different models deployed in AWS SageMaker, the method being deployment then access of Endpoint from a lambda function.

What I want to know is about using the free SageMaker Studio lab and after model deployment. I already see some differences in how I will deploy the model. So once model is deployed, is an endpoint set up and accessable in SageMaker? Will I be able to interface with the endpoint via a lambda function as is being done done with the normal SageMaker Studio?

Will this code be essentially the same (code from lambda function):

response = runtime.invoke_endpoint(EndpointName=ENDPOINT_NAME,
asked 8 months ago286 views
1 Answer
0

Studio Lab is a free online web application for learning and experimenting with data science and machine learning using Jupyter notebooks. Amazon Studio Lab runs on AWS, but doesn't require an AWS account, meaning you can use Studio Lab without connecting to AWS resources or by connecting to Amazon SageMaker resources for SageMaker Studio provided advanced machine learning capabilities, such as continuous integration and continuous delivery (SageMaker Pipelines), real-time predictions, large-scale distributed training, data preparation (Data Wrangler), data labeling (Ground Truth), feature store, bias analysis (Clarify), model deployment, and model monitoring in a production environment with fine-grained access control and security using Identity and Access Management (IAM), Virtual Private Cloud (VPC), and Key Management System (KMS).

In your case, I have observed that you are following this example [1] to connect to or access AWS SageMaker resources from Studio Lab. The notebook you are following is deploying the model to an Amazon SageMaker serverless endpoint (connecting your AWS resources (SageMaker) using Boto3). With that being said, I would like to inform you that the model and endpoint created will be accessible in AWS SageMaker. See below on how you can check if the model exists in the Amazon SageMaker console:

Check model is created by visiting: Console > Amazon SageMaker > Models
check endpoint is created: Console > Amazon SageMaker > Endpoints

In Studio Lab, the process of deploying a model and accessing the endpoint is similar to that in regular SageMaker Studio. You can interact with the endpoint using a lambda function, just like in regular SageMaker Studio [2]. Kindly note that the code you provided (response = runtime.invoke_endpoint(EndpointName=ENDPOINT_NAME,)) calls the InvokeEndpoint [3] API, which invokes an existing endpoint in an AWS account and returns the response from the endpoint. This API can be called from any requester as long as the requester has access to the public internet or access to the SageMaker runtime VPC endpoint [4].

If you require any further clarifications or have other questions, please don't hesitate to reply to this case, and I would be happy to assist.

Reference:

[1] https://github.com/aws/studio-lab-examples/blob/main/connect-to-aws/Access_AWS_from_Studio_Lab_Deployment.ipynb

[2] https://awstip.com/invoking-a-sagemaker-endpoint-from-a-python3-lambda-function-on-aws-f1305fc4bc95

[3] https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_runtime_InvokeEndpoint.html

[4] https://docs.aws.amazon.com/sagemaker/latest/dg/interface-vpc-endpoint.html

AWS
answered 8 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions