How to publish a lambda function in node.js to aws?

How to upload a lambda function in aws?

Search for: How to upload a lambda function in aws?

AWS lambda developer guide

AWS Toolkit for Eclipse

How to upload a node.js lambda function in aws?

Search for: How to upload a node.js lambda function in aws?

What should deployment package look like?

How to include dependent modules?

Difference between local and global modules

Deploy through console

Deploy through AWS CLI

My code depends on a public module

How do I make my code a module

I don't want to check my dependency module into github

How do I create a node module out of my code?

Search for: How do I create a node module out of my code?

aws serverless deployment npm module for Node.js

Search for: aws serverless deployment npm module for Node.js

AWS Lambda Deployment Package for Node.js

Search for: AWS Lambda Deployment Package for Node.js

The serverless npm package is document here

Here is the aws tutorial

No that is an eclipse tutorial. I want the console. See if this helps


//Correct: a .zip file with the following 
file1.js
file2.js
node_modules/module1/*
node_modules/moduel2/*

//Incorrect: a .zip file with the following 
//some-dir.zip
some-dir/file1.js
some-dir/file2.js
some-dir/node_modules/module1/*
some-dir/node_modules/moduel2/*

Here is the aws documentation for a lambda in node.js


You tell the lambda creation screen
the following

//Notice the .js is omitted
file1.someFunctionName

//the some-function-name 
//will have a signature as follows

exports.someFunctionName = function(event, context, callback) {
    console.log("value1 = " + event.key1);
    console.log("value2 = " + event.key2);  
    callback(null, "some success message");
 }

//the event, context, and callback
//are the lambda specific objects
//Read them up on the lambda site

yes. using the "send to compress" option in windows

But be sure not to zip the parent directory.

Choose the files and sub directories instead

Your .js file must be at the root level

This happens as part of the lambda function creation

Go ahead and create a new lambda function and in the process there is a place where you can upload the zip file or use an S3 location to which you may have uploaded the zip file

It appears this simple, however there are LOT of nuances....this is just the beginning of the itch

The aws UI, like all other web UIs may change often

So what I write here may become false

Bottom line is that such an option is available

so look arund

But for now, you take the option as if you are writing code for it online

Once the editor window for the code shows, there is a drop down on the left that exposes the zip options once open

This image also shows how the lambda function name is specified in the upper right

Notice zip is not mentioned among the available options. So you have to choose for now "Author from scratch"

must be assigned a role that has the permissions to be executed, write logs to the cloudwatch etc. When I know more roles as I go along I will document.

Any underlying system like aws defines a set of actions. Say like make a phone call. Read contacts. See this, or see that. etch. these are fixed capabilities offered by an underlying system.

these are called actions.

these actions can be grouped into any number of roles. like action buckets.

An admin has the ability then to assign those actions (via roles) to executable programs or other users. A lambda function is an executable program.