Skip to content

AWS Lambda function for autodeploying Lambda functions whenever a new codebase is uploaded to S3.

License

Notifications You must be signed in to change notification settings

5orenso/aws-lambda-autodeploy-lambda

Repository files navigation

Auto deploy lambda functions from S3

Build Status Coverage Status

Lambda handler to automatically publish Lambda functions when a new source is uploaded to S3. Installation is handled by AWS Cloudformation so don't worry.

To get started:_

$ bash ./bin/create-stack.sh --help

Features:

Important

Lambda function name has to be equal to base filename:
"hello-world.zip" will try to update a Lambda function with the name "hello-world"

Howto

Create S3 bucket before you start

$ aws s3api create-bucket --profile ife --bucket aws-lambda-static --region eu-west-1 --create-bucket-configuration LocationConstraint=eu-west-1

Install Node.js modules

$ npm install

Build a new release

$ grunt build

CloudFormation

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

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

Travis setup

To get auto deployment to S3 working you need to integrate with Travis CI.

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 branch Travis will run your tests and if all is green deploy the code to your S3 bucket.

Isn't this great? :D

Run Grunt watcher when you develop

$ cp ./bin/set-env-dist.sh ./bin/set-env.sh
$ . ./bin/set-env.sh
$ grunt watch

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

About

AWS Lambda function for autodeploying Lambda functions whenever a new codebase is uploaded to S3.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages