Introducing lambda-uploader, A Module for Uploading an AWS Lambda Function from Node.js
Written by @kylewbanks on Aug 26, 2015.
Hey! 👋 I recently left my job as a software engineer to become a full-time indie game developer. After four years of development you can find my first game, Farewell North, on Xbox, Nintendo Switch, and Steam!
lambda-uploader is a Node.js module for uploading a source directory to AWS Lambda as a function.
Installation
npm install lambda-uploader
Usage
Assuming you have a folder called /path/to/lambda-function that contains the source code and dependencies of a Lambda function:
var lambdaUploader = require('lambda-uploader');
lambdaUploader.uploadFunction(
'us-east-1', // Region
'my-awesome-function', // Function Name
'/path/to/lambda-function', // Lambda Function Source Directory
'index.handler', // Handler Name
'<Lambda Execution Role ARN>',
512, // Memory in Megabytes
30, // Timeout in Seconds
function(err) {
if (err) {
throw err;
}
console.log("Lambda function uploaded!");
}
);
Source Code
As always, the source code is available on GitHub and contributions are more than welcome.
Let me know if this post was helpful on Twitter @kylewbanks or down below!