Created
September 29, 2015 01:56
Revisions
-
jinman created this gist
Sep 29, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,30 @@ console.log('Loading event'); var AWS = require('aws-sdk'); exports.handler = function(event, context) { console.log("Request received:\n", JSON.stringify(event)); console.log("Context received:\n", JSON.stringify(context)); var lambdaFunctionArn = "arn:aws:lambda:us-west-2:555818481905:function:ProcessDeviceData-iot-test-hack-event-1"; var lambdaRegion = "us-west-2"; var params = { FunctionName: lambdaFunctionArn, InvocationType: 'RequestResponse', LogType: 'None', Payload: JSON.stringify(payload) }; var lambda = new AWS.Lambda({ region: lambdaRegion }); lambda.invoke(params, function(err, data) { if (err) { context.fail('ERROR:Invoking Lambda function: ' + err) } else { console.log('great success:' + JSON.stringify(data, null, ' ')); context.succeed('SUCCESS') } }); };