generator-express-lambda

0.1.10 • Public • Published

generator-express-lambda NPM version Build Status Dependency Status

A scaffolding tool to build an Express app quickly, for Serverless deployment to AWS Lambda, using Claudia.js.

It uses Yeoman to automatically generate a project with Express & Claudia.js, ready to deploy to AWS Lambda.

Generator Output

Dependencies

First, install Yeoman and generator-express-lambda using npm (we assume you have pre-installed node.js).

You'll also need awscli. This can be installed via brew: brew install awscli

Installation

To install, you'll need to globally install this package along with yo and claudia, if you don't already have it.

npm install -g yo claudia generator-express-lambda

About the AWS Free Tier & Pricing

The AWS Free Tier includes a million invocations for your Lambda apps per month. This should get you pretty far for hobby projects and development. You can find out more here: https://aws.amazon.com/free/

You can estimate your total cost of using AWS Lambda here: https://s3.amazonaws.com/lambda-tools/pricing-calculator.html

Getting your AWS Keys

To get your access key ID and secret access key

  1. Open the IAM console.
  2. From the navigation menu, click Users.
  3. Select your IAM user name.
  4. Click User Actions, and then click Manage Access Keys.
  5. Click Create Access Key.
  • Your keys will look something like this:
    • Access key ID example: AKIAIOSFODNN7EXAMPLE
    • Secret access key example: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
    • Click Download Credentials, and store the keys in a secure location.

Important

Your secret key will no longer be available through the AWS Management Console; you will have the only copy. Keep it confidential in order to protect your account, and never email it. Do not share it outside your organization, even if an inquiry appears to come from AWS or Amazon.com.

Setting up your AWS Keys

Run the following from your terminal to create your default AWS configuration, if one does not exist:

aws configure

Alternatively, if you already have keys setup and wish to create keys specifically for claudia.js, run:

aws configure --profile claudia

This will create keys under the profile [claudia], and leave the rest of your keys in tact.

Creating a New Project

Make a new directory for your project, and navigate into it.

mkdir <project-name>
cd <project-name>

Then generate your new project (from inside your new project directory):

yo express-lambda

This will create a ready-to-deploy Express application you can start your project from. It includes minimal dependencies to run your project locally, and deploy using Claudia.js.

Deploying your Project

When you are ready to deploy your project, run the following:

npm run deploy

Updating your Project

After deployment, to update your project, run:

npm run update

Where are my logs?

Logs from Lambda functions will appear in your AWS CloudWatch console. You can find your logs here: https://console.aws.amazon.com/cloudwatch/home?region=us-east-1#logs:

To make things easier, you can run the following command:

npm run logs

You may have to tweak the value in package.json if the generated command filters for the wrong name.

About Yeoman Generator

Getting To Know Yeoman

  • Yeoman has a heart of gold.
  • Yeoman is a person with feelings and opinions, but is very easy to work with.
  • Yeoman can be too opinionated at times but is easily convinced not to be.
  • Feel free to learn more about Yeoman.

License

MIT

Package Sidebar

Install

npm i generator-express-lambda

Weekly Downloads

10

Version

0.1.10

License

MIT

Unpacked Size

11.1 kB

Total Files

8

Last publish

Collaborators

  • kidgodzilla