// configure AWS Dependecies
var AWS = require('aws-sdk');
exports.handler = function(event, context) {
// EMR Client
var emr = new AWS.EMR({apiVersion: '2009-03-31', region: 'us-east-1'});
var params = {... dozens of params describing jobs ...};
var AWSRequest = emr.runJobFlow(params);
AWSRequest
.on('success', function(response){ console.log("success => " + response)})
.on('error', function(response){ console.log("error => " + response)})
.on('complete', function(response){ console.log("complete => " + response)})
.send( function(err, data){
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
context.done(null, 'λ Completed');
};