This is not the "official" AWS way -- see Erndob's answer for that.
The problem with the AWS way (sign each request with AWS credentials) is that most enterprises already have mature methods in place to manage authentication and authorization via their API gateways and (speaking as an enterpise architect) do not want to deal with the headache of duplicating this at the AWS-credential-level.
I'm sure that AWS will eventually integrate Step Functions with API Gateway but as of this writing (1/17) this is probably the simplest way to get the job done. Below is a trivial Lambda proxy function I wrote to leverage the SDK's ability to sign the requests:
'use strict';
const AWS = require('aws-sdk');
const stepfunctions = new AWS.StepFunctions();
exports.handler = (event, context, callback) => {
if(!event && event.action)
callback("Error: 'action' is required.");
if(!event && event.params)
callback("Error: 'params' is required.");
stepfunctions[event.action](event.params, function (err, data) {
if (err)
console.log(err, err.stack);
callback(err, data);
});
};
You will need to grant your Lambda privs to interact with your Step Functions. To give it full access to all operations create a new role and attach the following policies:
- AWSLambdaBasicExecutionRole
- AWSStepFunctionsFullAccess
Now configure the Lambda to be invoked via API gateway as normal, passing in an event with two properties:
And be sure to lock your API down! :-)