Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
js-app
python-lambda
README.md

README.md

Rockset + AWS Lambda

Prerequisites

  • This guide assumes that you are familiar with AWS Lambda.
  • The instructions below require Python3.7 or higher for installation.
  • Please read the blog post on rockset.com for instructions and details on using this example.

Installation

  1. Clone this repository.
  2. Enter the rockset-aws-lambda/python-lambda directory, open credentials.py and fill in your Rockset API_KEY.
  3. Run the build-package.sh script from that directory. This script downloads the dependencies and packages it up into a functions.zip file. This is the zip that we will upload to AWS Lambda
  4. Create an AWS Lambda function. You can do this using the below command. You will need to create/use the appropriate role in the command. See lambda roles for details.
aws lambda create-function \
    --function-name my-function \
    --runtime=python3.7 \
    --role=<specify-role-here> \
    --handler=lambda_function.lambda_handler \
    --zip-file fileb://function.zip

API Gateway

You can set up API Gateway to serve the lambda once it has been uploaded. Detailed instructions can be found in the create an API with the Lambda Custom Integration tutorial.

Client Setup

  1. Once the API Gateway and endpoint is set up and operational, you can use it within the sample web application.
  2. Open rockset-aws-lambda/js-app/assets/js/script.js.
  3. Fill in the LAMBDA_URL field within the JS file with the API endpoint URL.
  4. Run a local Python HTTP server and serve index.html to run the webpage.

Updating the lambda

If you're experimenting and iterating on the lambda function by changing the query, you can update the lambda using the below command.

aws lambda update-function-code \
    --function-name my-function \
    --zip-file fileb://function.zip
You can’t perform that action at this time.