Skip to content

5orenso/aws-lambda-boilerplate

Repository files navigation

A nice boilerplate for a new AWS Lambda function

Build Status Coverage Status

A good start for an AWS Lambda function. If you combine this with the aws-lambda-autodeploy-lambda you will have a very fast deployment process. When you push code to Github.com it will only take a couple of minutes to run all your test, deploy you code to S3 and refresh the Lambda function. All automatic while you're drinking a fresh cup of newly brewed coffee.

Features:

Getting started with development

$ git clone
$ npm install
$ cp ./bin/set-env-dist.sh ./bin/set-env.sh
$ . ./bin/set-env.sh
$ npm run test:watch

Run all tests

$ npm test

Lint all of the relevant code

$ npm run lint

Build a new release

$ npm run build

Report coverage to Coveralls.io

$ npm run coverage

Update changelog

$ bash ./changelog.sh

Travis and Coveralls setup

To get auto coveralls reporting working you need to add your encrypted Coveralls token in .travis.yml.

This is how you do it:

$ travis encrypt COVERALLS_REPO_TOKEN=<super_secret coveralls token> --add env.global

Steps for preparing your repo:

  1. Connect your Github.com repo to your Travis CI account. https://travis-ci.org/
  2. Add AWS_ACCESS_KEY and AWS_SECRET_KEY to your Travis CI environment.
  3. Edit .travis.yml to match your bucket, upload-dir and region.
  4. Copy .coveralls-dist.yml to .coveralls.yml and add you secret key.

Next time you push to your master brach Travis will run your tests and if all is green report coverage to Coveralls.

Isn't this great? :D

CloudFormation

# To create a new stack:
$ bash ./bin/create-stack.sh

# To update a current stack:
$ bash ./bin/create-stack.sh -u

Howto check for vulnerabilities in modules

# Install Node Security Platform CLI
$ npm install nsp --global  

# From inside your project directory
$ nsp check  

Howto upgrade modules

$ npm install -g npm-check-updates
$ ncu -u
$ npm install --save --no-optional

Other Resources