Git Product home page Git Product logo

aws-lambda-nodejs-boilerplate's Introduction

Simple AWS Lambda Node.js Boilerplate

This is a simple Node.js AWS Lambda seed to get you going. It uses node-lambda for locally running and deploying. It logs with Bunyan, and has a simple async waterfall in it's index.js to give you one approachin handling flow control in a Lambda function.

Basic

  1. npm i -g aws-sdk to install AWS SDK if you haven't already.
  2. npm i in repo directory to build node modules.
  3. npm run start to try it out (locally)! Everything works, right? Good! Let's get it into the cloud...
  4. Configure aws-sdk in your home directory. Ensure the Lambda-controlling aws_access_key_id and aws_secret_access_key are in, e.g., ~/.aws. This way you don't have to keep this in .env which I prefer to keep in version control.
  5. Create a Lambda function on AWS. Edit .env to your Lambda function; and function name in package.json.
  6. npm run deploy to push into the cloud...
  7. Go to AWS Lambda console and test if it works. It does, right? Great! Start editing index.js to whatever you want. You can mock data in event.json. Look at deploy.env.example if you want to send along secret variables (change name to deploy.env) that don't go to git.

Advanced

  1. Go to the AWS Lambda console and create two aliases, PROD and STAG.
  2. Point STAG to $latest version. This way, whenever you deploy, STAG will always use the newest deployment.
  3. Ready to update PROD? Use npm run updateProd and it will create a new version from $latest and point PROD to that version.
  4. How to use this setup? When you invoke a Lambda function from, e.g., API Gateway, you can choose, e.g., MyFunctionName:PROD, and use STAG for, well, staging or development.

aws-lambda-nodejs-boilerplate's People

Contributors

bluepeter avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

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