1 | # node-lambda
|
2 |
|
3 | ![node-lambda](../master/node-lambda.png?raw=true)
|
4 |
|
5 | Command line tool to locally run and deploy your node.js application to [Amazon Lambda](http://aws.amazon.com/lambda/).
|
6 |
|
7 | [![BuildStatus](https://travis-ci.org/RebelMail/node-lambda.png?branch=master)](https://travis-ci.org/motdotla/node-lambda)
|
8 | [![NPM version](https://badge.fury.io/js/node-lambda.png)](http://badge.fury.io/js/node-lambda)
|
9 |
|
10 | ```
|
11 | node-lambda run
|
12 | ```
|
13 |
|
14 | ## Installation
|
15 |
|
16 | ```
|
17 | npm install -g node-lambda
|
18 | ```
|
19 |
|
20 | ## Example App
|
21 |
|
22 | The [node-lambda-template](https://github.com/RebelMail/node-lambda-template) example app makes it easy to get up and running.
|
23 |
|
24 | ## Usage
|
25 |
|
26 | There are 3 available commands.
|
27 |
|
28 | ```
|
29 | node-lambda setup
|
30 | node-lambda run
|
31 | node-lambda deploy
|
32 | ```
|
33 |
|
34 | ### Commands
|
35 |
|
36 | #### setup
|
37 |
|
38 | Initializes the `event.json` and `.env` files. `event.json` is where you mock your event. `.env.` is where you place your deployment configuration.
|
39 |
|
40 | ```
|
41 | $ node-lambda setup --help
|
42 |
|
43 | Usage: run [options]
|
44 |
|
45 | Options:
|
46 |
|
47 | -h, --help output usage information
|
48 | ```
|
49 |
|
50 | After running setup, it's a good idea to gitignore the generated `event.json` and `.env` file.
|
51 |
|
52 | ```
|
53 | echo ".env\nevent.json" >> .gitignore
|
54 | ```
|
55 |
|
56 | #### run
|
57 |
|
58 | Runs your Amazon Lambda index.js file locally. Passes `event.json` data to the Amazon Lambda event object.
|
59 |
|
60 | ```
|
61 | $ node-lambda run --help
|
62 |
|
63 | Usage: run [options]
|
64 |
|
65 | Options:
|
66 |
|
67 | -h, --help output usage information
|
68 | -h, --handler [index.handler] Lambda Handler {index.handler}
|
69 | ```
|
70 |
|
71 | #### deploy
|
72 |
|
73 | Bundles and deploys your application up to Amazon Lambda.
|
74 |
|
75 | ```
|
76 | $ node-lambda deploy --help
|
77 |
|
78 | Usage: deploy [options]
|
79 |
|
80 | Options:
|
81 |
|
82 | -h, --help output usage information
|
83 | -e, --environment [staging] Choose environment {development, stating, production}
|
84 | -a, --accessKey [your_key] AWS Access Key
|
85 | -s, --secretKey [your_secret] AWS Secret Key
|
86 | -r, --region [us-east-1] AWS Region
|
87 | -n, --functionName [node-lambda] Lambda FunctionName
|
88 | -h, --handler [index.handler] Lambda Handler {index.handler}
|
89 | -m, --mode [event] Lambda Mode
|
90 | -o, --role [your_role] Amazon role
|
91 | -m, --memorySize [128] Lambda Memory Size
|
92 | -t, --timeout [3] Lambda Timeout
|
93 | -d, --description [missing] Lambda Description
|
94 | -u, --runtime [nodejs] Lambda Runtime
|
95 | ```
|
96 |
|
97 | ## Contributing
|
98 |
|
99 | 1. Fork it
|
100 | 2. Create your feature branch (`git checkout -b my-new-feature`)
|
101 | 3. Commit your changes (`git commit -am 'Added some feature'`)
|
102 | 4. Push to the branch (`git push origin my-new-feature`)
|
103 | 5. Create new Pull Request
|
104 |
|
105 | ## Running tests
|
106 |
|
107 | ```
|
108 | npm install
|
109 | npm test
|
110 | ```
|