Easily create lambda6 microservices using this generator for Yeoman. If you aren't familiar with Yeoman, it's a scaffolding tool that helps developers eliminate the boilerplate tasks of setting up a new Node.js project. Check it out!
npm install -g generator-lambda6
mkdir my-lambda6-service && cd $_
yo lambda6
This will start the Yeoman wizard, which will prompt you about the options you want to enable. Once that's done, the dependencies will be installed and your project should be ready to build:
gulp
Consult the generated README.md
file for more details.
- babel: compiles
src
directory intodist
for uploading - mocha and chai for unit testing
- gulp for easy building
- .travis.yml that's ready to use
- other configuration files: .gitignore, .npmignore, etc.
If you're reading this, you most likely have these installed already, you savvy developer, you! Otherwise, go ahead and install the latest version of Node.js (npm is included) using whatever method works for your OS.
You'll need Yeoman installed, which requires Node.js and npm (above):
npm install -g yo
Be sure to read the AWS Lambda Developer Guide, specifically the sections on authoring Node.js Lambda functions. This is essential to understanding what this generator does. This generator will create a project that builds a lambda.zip
bundle containing your Node.js code so that it can be deployed on AWS Lambda. It will also create build steps in the gulpfile.babel.js
file to automatically upload and provision the Lambda function to AWS. You'll need an AWS account and appropriate access privileges to do this, of course.
First of all, be sure to familiarize yourself with lambda6 as well as so you understand the programming model that the generated handler function implements. By invoking an AWS Lambda function with an operation
and payload
, the function can essentially operate as a microservice. This is a key design principle so that functions are neither too bloated for what they do nor too overloaded (spanning too many concerns).