Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

invoke lambda nodejs

var AWS = require('aws-sdk');
AWS.config.region = 'eu-west-1';
var lambda = new AWS.Lambda();

exports.handler = function(event, context) {
  var params = {
    FunctionName: 'Lambda_B', // the lambda function we are going to invoke
    InvocationType: 'RequestResponse',
    LogType: 'Tail',
    Payload: '{ "name" : "Alex" }'
  };

  lambda.invoke(params, function(err, data) {
    if (err) {
      context.fail(err);
    } else {
      context.succeed('Lambda_B said '+ data.Payload);
    }
  })
};
Comment

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
Comment

PREVIOUS NEXT
Code Example
Javascript :: get current url javascript 
Javascript :: how to limit the number of items from an array in javascript 
Javascript :: react native network request failed fetch 
Javascript :: javascript regex check if string is empty 
Javascript :: Do not know how to serialize a BigInt 
Javascript :: js wait 5 second 
Javascript :: node js get files in dir 
Javascript :: count occurrences of character in string javascript 
Javascript :: SyntaxError: Cannot use import statement outside a module node js 
Javascript :: toggle jquery remove others 
Javascript :: use set to remove duplicates in javascript 
Javascript :: how to redirect in ionic react 
Javascript :: discord js sending a message to a specific channel 
Javascript :: double matrix iteration in react 
Javascript :: js get element by class 
Javascript :: update node mac 
Javascript :: dotnet core ajax post of an ojject site:stackoverflow.com 
Javascript :: create hash in node js 
Javascript :: how to get session javascript ws3schools 
Javascript :: jquery create input hidden 
Javascript :: javascript body element 
Javascript :: jquery when any key is pressed 
Javascript :: jquery :not class 
Javascript :: javascript date to utc format 
Javascript :: How find a specific character in js 
Javascript :: js last element of array 
Javascript :: add expiry to jwt extended token 
Javascript :: find difference in array of objects javascript 
Javascript :: confirm before leaving page javascript 
Javascript :: @jsonignore unrecognized field 
ADD CONTENT
Topic
Content
Source link
Name
2+5 =