Tiny command line tool to create, run, and deploy AWS Lambda functions.
$ instant-lambda create your-awesome-lambda
$ npm install -g instant-lambda
Invoke 4 commands using either instalam
or instant-lambda
.
$ instalam create your-awesome-lambda
$ cd your-awesome-lambda
$ instalam run
$ instalam pack
$ instalam deploy
$ instalam create <your-lambda-name>
Creates a new directory with your AWS Lambda name and sets up template files in the directory. The template files include app.js
, lambda-config.json
, deploy-config.json
, event.json
, and package.json
.
This is where you write your actuall Lambda function handler. Default handler method name is set to main
. However, this can be configured in lambda-config.json
as well as handler file name, which is app
by default.
This file is used to configure details of your Lambda. The JSON should look like
{
"runtime": "nodejs6.10",
"role": "arn:aws:iam::XXXXXXXXXXXX:my/iam/role",
"handlerFile": "app",
"handlerMethod": "main",
"description": "My AWS Lambda function.",
"timeout": "3",
"memorySize": "128",
"environment:": {
"variables": {}
},
"functionName": "your-lambda-name"
}
See also AWS.Lambda.createFunction - AWS SDK for JavaScript.
This file contains information which instalam deploy
command uses to upload your Lambda to AWS. Currently deploy
command retrieves only your AWS region from this JSON file.
If you wish to pass an event to your Lambda when you run it locally with instalam run
command, you can do so by defining your event in this JSON file.
Of course you can use node packages in your Lambda!
$ instalam run
Runs your Lambda locally. Passes an event defined in event.json
to your Lambda.
$ instalam pack
Packages necessary files and all the dependencies in a zip file.
$ instalam deploy
Uploads your packaged Lambda function to AWS. You need to run instalam pack
before deploying.
Currently instant-lambda does not automatically retrieve your authentication credentials. Before running this command, you need to set your AWS credentials as environment variables.
To set your authentication credentials, you can do something like
$ export AWS_ACCESS_KEY_ID='XXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
$ export AWS_SECRET_ACCESS_KEY='XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
Currently not configured.
- Fork it
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create new Pull Request