var aws = require('aws-sdk') exports.handler = (event, context, callback) => { var params = { stateMachineArn: 'arn:aws:states:us-east-1:1234567890:stateMachine:Helloworld', input: JSON.stringify({}) }; var stepfunctions = new aws.StepFunctions() stepfunctions.startExecution(params, (err, data) => { if (err) { console.log(err); const response = { statusCode: 500, body: JSON.stringify({ message: 'There was an error' }) }; callback(null, response); } else { console.log(data); const response = { statusCode: 200, body: JSON.stringify({ message: 'Step function worked' }) }; callback(null, response); } }); }