Skip to content

Running as AWS Lambda Design

Ilya Sher edited this page Dec 6, 2018 · 7 revisions

Running as AWS Lambda Design (WIP)

Requirements

  • Support the AWS Lambda request object
  • Support requests routing, similar to express.js routing
  • For development purposes, there should be an easy way to call any handler from the command line
  • Support request mapping to restful format such as /account or /account/:id
  • Standard data structure to return status code.
  • Access to header and query string objects both as map

Design

  • Use layers to provide the runtime separately from the main Lambda code.

LambdaRequest type

TODO

Runtime layer

  • bootstrap - an NGS file, according to what's described in Custom AWS Lambda Runtimes
    • require()s _HANDLER file
    • (UNSURE YET) calls some initializaiton function
    • Enters the request processing loop (curl, call the _HANDLER specified function, etc) as describe in "Processing Tasks" in the document mentioned above.

The deployment package layer

  • F handler(req:LambdaRequest)

TODO / Open Issues

  • Requests routing
  • Easy calling from command line for development / debugging purposes
    • Maybe a way to pass the whole LambdaRequest to the handler function
      • LambdaRequest in this case should have sane defaults so that not everything (all properties) will have to be passed on each call from CLI
    • A way to call the handler multiple times to debug the initialization code / global state / cleanup.

Resources