Git Product home page Git Product logo

claudia-local's Introduction

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.

claudia-local's People

Contributors

stojanovic avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.