Is there a way to store every execution to DynamoDB since AWS Step Function's execution will be deleted after a month.
Asked
Active
Viewed 1,713 times
0

John Rotenstein
- 241,921
- 22
- 380
- 470

San
- 307
- 1
- 3
- 18
-
1There is unlikely to be an "out of the box" method for doing this. Do you know a way to access/export the executions? If so, you could then insert them into DynamoDB, or even just store them in S3. – John Rotenstein Feb 27 '19 at 22:35
-
I don't know how to export the executions @JohnRotenstein – San Mar 06 '19 at 06:27
2 Answers
2
You can use the AWS StepFunctions API to do that. You can get a list of the executions of a state machine with ListExecutions, and get the history of an execution using GetExecutionHistory. You can then store the result of those calls.

Kalev
- 1,158
- 7
- 17
-
How will I invoke the GetExecutionHistory? I mean where would I place its parameters? – San Mar 06 '19 at 07:42
-
1It depends on how you make the API requests. I would choose one of the programming languages (see bottom of the pages in the links), and write a short program to do that. – Kalev Mar 06 '19 at 11:10
0
You can add first step in your machine where you get its execution ARN from context and put it to DynamoDB table
The step may look like this:
"Put item into DynamoDB": {
"Type": "Task",
"Resource": "arn:aws:states:::dynamodb:putItem",
"Parameters": {
"TableName": "<your-table-name>",
"Item": {
"job_id": {
"S.$" : "$$.Execution.Id"
}
}
},
"Next": "<next-task>"
}

nt86
- 1,480
- 12
- 12