Why do we use AWS Lambda function to invoke sagemaker model endpoint? I know we can use lambda and sagemaker endpoint independently but came across some usecases where both are used. Not sure how they work together and whats the benefit of using both of them. I know for sagemaker we need to specify count and size of instance which is stays always up and we can specif auto scale for it, and for lambda, being serverless, it is up only to serve the request.
1 Answer
I'm assuming you're asking about using Lambda functions to invoke SageMaker endpoint (rather than using Lambda to invoke a model). The most common use case where you'd use a Lambda function is to integrate your endpoint with your public facing application. SageMaker endpoints can only be accessed within the account using IAM policies, so if you were to set up a web app that needs to invoke the endpoint, you'd use API Gateway and Lambda to do so. See a sample post here - https://aws.amazon.com/blogs/machine-learning/creating-a-machine-learning-powered-rest-api-with-amazon-api-gateway-mapping-templates-and-amazon-sagemaker/