Skip to content

⚠️ Work in progress ⚠️ Run AWS Lambda functions created with Claudia.js locally

Notifications You must be signed in to change notification settings

claudiajs/claudia-local

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

claudia-local

[WIP] Run AWS Lambda functions created with Claudia.js locally.

This project is based on docker-lambda created by Michael Hart. Inspired by SAM Local.

Example

If you have lambda.js file that looks like this:

exports.handler = function (event, context) {
  context.succeed('hello world');
};

You can run following command from the same directory:

claudia-local --handler lambda.handler

And result should look like this:

Example in terminal

Features

At the moment, this is more like a TODO list, than a list of features:

  • Run AWS Lamda function on docker-lambda locally
  • Simulate AWS Lambda memory
  • Simulate AWS Lambda timeout
  • Use selected IAM role
  • Read claudia.json if it exists
  • Patch the assume role policy to allow claudia-local to use selected role
  • Event generator — generate JSON triggers for S3, SNS, etc.
  • Simple HTTP server that simulates API Gateway

Installation

Prerequisites

Running serverless projects and functions locally requires Docker to be installed and running.

To install docker visit:

Verify that docker is working, and that you can run docker commands from the CLI (for example: docker ps). You do not need to install/fetch/pull any containers, that will be done automatically.

Install from NPM

TBA

Install from github

If you want to run dev version, you'll need to:

  1. Clone this repository and enter the project folder
  2. Install the dependencies (npm i)
  3. Link the script (npm link)

After that, claudia-local command will point to the local version of the code.

Command line arguments

List of currently available arguments:

  • handler — specify handler function in format file_name.exported_name, for example if your index.js file uses module.handler for export, handler should be index.handler.
  • timeout — specify AWS Lambda timeout in seconds, default is 3, and it can be between 3 and 300 seconds.
  • memory — specify AWS Lambda memory in MBs, default is 128, and it can be between 128 and 1536 (1.5 GB) in 64MB increments.
  • runtime — specify AWS Lambda runtime, default is nodejs6.10, and it can be nodejs6.10 or nodejs4.3.
  • event — [will change] specify JSON event that will be passed as AWS Lambda event. At the moment in --event '{"hello": "world"}' format.

About

⚠️ Work in progress ⚠️ Run AWS Lambda functions created with Claudia.js locally

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published