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 :: how to call a function javascript 
Javascript :: react faq 
Javascript :: how to add multiple objects into array in javascript 
Javascript :: destructuring an array 
Javascript :: resize js 
Javascript :: dispatch store 
Javascript :: Sha256 decrypt javascript 
Javascript :: javascript loop object key value 
Javascript :: remix js 
Javascript :: Geometery parsing GeoJSON 
Javascript :: sails js 
Javascript :: add to json object javascript 
Javascript :: react native notifications error 
Javascript :: flatten array 
Javascript :: code splitting react 
Javascript :: new useSelector 
Javascript :: bind method in js 
Javascript :: how to count characters 
Javascript :: Using Props With React: With Props 
Javascript :: last element from list javascript 
Javascript :: javascript 00:00:00 / 00:00:00 clock 
Javascript :: Div draggable x axe only 
Javascript :: AND Or condition in text with bracket how to divide in javascript 
Javascript :: eslint-disable-next-line multiple 
Javascript :: Biliothek 
Javascript :: how to use browser sync in vuetify 
Javascript :: javascript expressions JSX 
Javascript :: js browse file 
Javascript :: javascript terminal base64 encoder 
Javascript :: blazor sample ujsing cliam policy 
ADD CONTENT
Topic
Content
Source link
Name
9+5 =