Skip to content

Latest commit

 

History

History
65 lines (47 loc) · 1.89 KB

Readme.md

File metadata and controls

65 lines (47 loc) · 1.89 KB

AWS Lambda

BentoML has great support for AWS Lambda. You can deploy, update and delete Lambda deployment with single command, and customize deployment to fit your needs with parameters such as region, memory_size and timeout.

Pre-requsities:

Run

Deploying BentoML service to AWS Lambda

git clone git@github.com:bentoml/aws-lambda-deploy.git
cd aws-lambda-deploy
# create a conda env
pip install -r requirements.txt

Update the lambda-config.json configuration as required

{
  "region": "us-east-1",
  "timeout": 60,
  "memory_size": 1024
}

Finally, create a lambda deployment

BENTO_BUNDLE_PATH=$(bentoml get TransformerSentimentService:latest --print-location -q)
python deploy.py $BENTO_BUNDLE_PATH sentiment-lambda-deployment lambda_config.json

Get information about deployment

python describe.py sentiment-lambda-deployment

Test the lambda application

curl -i -X POST "https://6p43vhnw7i.execute-api.us-east-1.amazonaws.com/Prod/predict" -H  "accept: */*" -H  "Content-Type: application/json" -d "{\"text\":\"i like you\"}"

Delete the lambda application (if required)

python delete.py sentiment-lambda-deployment

Update the existing lambda deployment with new image (if required)

python update.py <new Bento_bundle_path> <new Deployment_name> <Config_JSON>