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.
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
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
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
- Open the IAM console.
- From the navigation menu, click Users.
- Select your IAM user name.
- Click User Actions, and then click Manage Access Keys.
- 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.
- Access key ID example:
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.
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.
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.
When you are ready to deploy your project, run the following:
npm run deploy
After deployment, to update your project, run:
npm run update
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.
- 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.
MIT