aws lambda js example

Example 1: aws lambda function setup for node js

// first install serverless
$  npm install -g serverless
// create basic template
$  serverless create --template aws-nodejs --name candidate
// configure aws and genrate client id and client secret
serverless config credentials --provider aws --key <your_access_key_id> --secret <your_access_key_secret>
 // deploy
  serverless deploy

Example 2: aws lambda tutorial

callback();                // It will return success, but no indication to the caller
callback(null);            // It will return success, but no indication to the caller
callback(null, "success"); // It will return the success indication to the caller
callback(error);           //  It will return the error indication to the caller