1.1.1 • Public • Published


An npm module to help you run and test Lambda functions locally

This module has been designed to be run by npm as part of a test script. It is a replacement for similar grunt/gulp Lambda plugins and is useful for developers wishing to use npm for everything.

  • This module allows you to run and test Lambda functions on your computer or in a continuous integration setting.
  • You can pass in any event data JSON object to simulate a Lambda event.
  • The context object is taken care off for you by the module.

Getting Started

This module is designed to be run by npm to facilitate testing of Lambda functions. To install it run:

npm install run-local-lambda --save-dev

Your Lambda function should have a package.json which you can modify to add a test script like so:

"scripts": {
    "test": "run-local-lambda --file index.js --event tests/event.json --timeout 3"

Finally, you can invoke your test by simply running:

npm test

Global Installation

You can also install this module globally and run it from the command line:

npm install -g run-local-lambda

To run your Lambda function, invoke the following:

run-local-lambda --file index.js --event event.json



This module accepts the following parameters which are all optional.

  • --file [lambda file name] - Lambda function file name. Default: index.js
  • --event [event file name] - Event data file name. Default: event.json
  • --handler [handler name] - Lambda function handler. Default: handler
  • --timeout [timeout seconds] - The timeout in seconds. Default: 3


The context object provides the following public methods:

  • context.succeed(Object result)
  • error)
  • context.done(Error error, Object result)
  • context.getRemainingTimeInMillis()

Please note that the implementation of these methods are approximations to enable Lambda functions to execute. See AWS docs for more information.


The event data file can be provided using the --event parameter. An event is just a JSON object such as:


See this AWS documentation for more information on testing Lambda functions manually.


There is no style guide so please try to follow the existing coding style. Please supply unit tests for any or modified functionality. Any and all PRs will be warmly welcomed.

Release History


Updated to work with node.js 4.3 update of Lambda


Initial Release

Package Sidebar


npm i run-local-lambda

Weekly Downloads





The MIT License

Last publish


  • sbarski