- Newest
- Most votes
- Most comments
You are looking to manage Input and Output Processing in Step Functions, which uses the InputPath, ResultPath, and OutputPath to manipulate the JSON state payload through the state machine. There are examples here: https://docs.aws.amazon.com/step-functions/latest/dg/input-output-example.html
Your desired output above has keys in an array, which won't work, but you can change StepResult to an object. You would just need to format the Lambda results payload contents, and then use something like resultPath: '$.StepResult.Step1'
Your Lambda steps would be defined in the TypeScript something like this:
const stepOne = new tasks.LambdaInvoke(this, 'Step One', {
lambdaFunction: getStatusLambda,
outputPath: '$.Payload',
resultPath: '$.StepResult.Step1'
});
and your Activity might look something like this:
const submitJobActivity = new sfn.Activity(this, 'StepTwo');
new tasks.StepFunctionsInvokeActivity(this, 'Step Two', {
activity: submitJobActivity,
outputPath: '$.Payload',
resultPath: '$.StepResult.Step2'
});
Note this will preserve the rest of the state payload (JSON) so not exactly the output you describe as the input payload would be merged with the outputs.
Relevant content
- asked 3 months ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated a year ago