GithubHelp home page GithubHelp logo

southpolesteve / node-lambda Goto Github PK

View Code? Open in Web Editor NEW

This project forked from motdotla/node-lambda

0.0 2.0 0.0 148 KB

Command line tool to locally run and deploy your node.js application to Amazon Lambda

JavaScript 100.00%

node-lambda's Introduction

node-lambda

node-lambda

Command line tool to locally run and deploy your node.js application to Amazon Lambda.

BuildStatus NPM version

node-lambda run

Installation

npm install -g node-lambda

Example App

The node-lambda-template example app makes it easy to get up and running.

Usage

There are 3 available commands.

node-lambda setup
node-lambda run
node-lambda deploy

Commands

setup

Initializes the event.json, .env files, and deploy.env files. event.json is where you mock your event. .env. is where you place your deployment configuration. deploy.env has the same format as .env, but is used for holding any environment/config variables that you need to be deployed with your code to Lambda but you don't want in version control (e.g. DB connection info).

$ node-lambda setup --help

  Usage: run [options]

  Options:

    -h, --help                     output usage information

After running setup, it's a good idea to gitignore the generated event.json and .env files.

echo ".env\ndeploy.env\nevent.json" >> .gitignore

run

Runs your Amazon Lambda index.js file locally. Passes event.json data to the Amazon Lambda event object.

$ node-lambda run --help

  Usage: run [options]

  Options:

    -h, --help                     output usage information
    -h, --handler [index.handler]  Lambda Handler {index.handler}

deploy

Bundles and deploys your application up to Amazon Lambda.

$ node-lambda deploy --help

  Usage: deploy [options]

  Options:

    -h, --help                        output usage information
    -e, --environment [staging]       Choose environment {development, staging, production}
    -a, --accessKey [your_key]        AWS Access Key
    -s, --secretKey [your_secret]     AWS Secret Key
    -r, --region [us-east-1]          AWS Region(s)
    -v, --version [custom-version]    Lambda Version
    -n, --functionName [node-lambda]  Lambda FunctionName
    -h, --handler [index.handler]     Lambda Handler {index.handler}
    -c, --mode [event]                Lambda Mode
    -o, --role [your_role]            Amazon Role ARN
    -m, --memorySize [128]            Lambda Memory Size
    -t, --timeout [3]                 Lambda Timeout
    -d, --description [missing]       Lambda Description
    -u, --runtime [nodejs]            Lambda Runtime
    -f, --configFile []               Path to file holding secret environment variables (e.g. "deploy.env")`

Custom Environment Variables

AWS Lambda doesn't let you set environment variables for your function, but in many cases you will need to configure your function with secure values that you don't want to check into version control. Use the sample deploy.env file to set environment variables that will be prepended to your compiled Lambda function before it gets uploaded to S3. For example, a DB connection string or encryption key.

Other AWS Lambda Tools Projects

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Running tests

npm install
npm test

node-lambda's People

Contributors

allain avatar christianklotz avatar davemkirk avatar djm avatar jraede avatar motdotla avatar

Watchers

 avatar  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.