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

satya - 6/3/2019, 1:38:31 PM

How to upload a lambda function in aws?

How to upload a lambda function in aws?

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

satya - 6/3/2019, 1:41:53 PM

AWS lambda developer guide

AWS lambda developer guide

satya - 6/3/2019, 1:42:16 PM

AWS Toolkit for Eclipse

AWS Toolkit for Eclipse

satya - 6/3/2019, 1:43:59 PM

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

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

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

satya - 6/3/2019, 2:42:50 PM

Key goals

What should deployment package look like?

How to include dependent modules?

Difference between local and global modules

Deploy through console

Deploy through AWS CLI

satya - 6/3/2019, 2:46:59 PM

How do I specify my dependency on another module that is public

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

satya - 6/3/2019, 3:07:39 PM

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

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

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

satya - 6/4/2019, 3:23:28 PM

aws serverless deployment npm module for Node.js

aws serverless deployment npm module for Node.js

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

satya - 6/4/2019, 3:32:19 PM

AWS Lambda Deployment Package for Node.js

AWS Lambda Deployment Package for Node.js

Search for: AWS Lambda Deployment Package for Node.js

satya - 6/4/2019, 3:59:50 PM

The serverless npm package is document here

The serverless npm package is document here

satya - 6/4/2019, 5:03:33 PM

Here is the aws tutorial

Here is the aws tutorial

satya - 6/4/2019, 5:16:51 PM

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

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

satya - 6/5/2019, 9:38:16 AM

How to copy the AWS S3 Path to the clipboard in AWS

satya - 6/5/2019, 9:58:00 AM

Directory structure of the package


//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/*

satya - 6/5/2019, 9:58:23 AM

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

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

satya - 6/5/2019, 10:01:37 AM

How do you specify the invoking function in the package above?


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

satya - 6/5/2019, 10:04:10 AM

Can I zip these files in windows?

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

satya - 6/5/2019, 10:06:04 AM

Where do I upload the zip file for a lambda function?

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

satya - 6/5/2019, 10:06:43 AM

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

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

satya - 6/5/2019, 10:11:23 AM

How come I can't find the option to specify a Zip file for lambda function creation?

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

satya - 6/5/2019, 10:12:16 AM

Here is that image

satya - 6/5/2019, 10:12:42 AM

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

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

satya - 6/5/2019, 10:18:27 AM

Here is how this screen shows up

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

satya - 6/5/2019, 10:36:44 AM

Roles: Further more, your lambda function...

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.

satya - 6/5/2019, 10:41:31 AM

What are roles?

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.

satya - 6/5/2019, 10:45:09 AM

Here is an image