model-zoo/scikit-learn-lambda

Add template for Serverless Application Model (SAM) deployment

yoavz opened this issue · 0 comments

yoavz commented

Add support for deploying with https://aws.amazon.com/serverless/sam/. I believe all that is required is a template.yaml file that should look something like:

AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: ...
Resources:
  ScikitLearnFunction:
    Type: AWS::Serverless::Function
    Properties:
      Handler: scikit_learn_lambda.handler
      Runtime: python3.7
      MemorySize: 1024
      Environment:
        Variables:
          SKLEARN_MODEL_PATH: "model.joblib"
      Layers:
        - ...
      Events:
        HttpPost:
          Type: Api
          Properties:
            Path: '/predict'
            Method: post

Similar to the serverless.yaml template, this should have documentation on how to deploy a model that is packaged with the code and a how to deploy a model from S3, including the required IAM permissions for S3 reads.