How to send a unique value(UUID4) to the step function is the json format, when it was triggered every time from the cloudwatch event rules? Can any one help on this. Thanks in advance.
Since AWS recently added Step Functions as a CloudWatch target, you could easily make the first function in the Step Function generate the UUID. And then pass that down to the next function. This would allow the Step Function to be self contained.
"GenerateUuid": {
"Type": "Task",
"Resource": "arn:aws:states:us-east-1:123456789012:activity:GenerateUuid",
"Next": "CreateNewRecord"
},
Another way is to have a Lambda function generate the UUID and pass is into the State Machine which you could again trigger from a CloudWatch event.
var params = {
stateMachineArn: 'MyStateMachine-12345',
input: uuidv4()
};
stepfunctions.startExecution(params, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});