-
-
Save ndinh215/bb681c55dee248dcc1b35948d9088c60 to your computer and use it in GitHub Desktop.
DynamoDB table iteration with a StepFunction
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"StartAt": "Add empty LastEvaluatedKey", | |
"States": { | |
"Add empty LastEvaluatedKey": { | |
"Type": "Pass", | |
"Next": "Scan", | |
"Result": { | |
"LastEvaluatedKey": null | |
}, | |
"ResultPath": "$" | |
}, | |
"Scan": { | |
"Type": "Task", | |
"Next": "Map", | |
"Parameters": { | |
"TableName": "", | |
"ProjectionExpression": "#id", | |
"ExpressionAttributeNames": { | |
"#id": "id" | |
}, | |
"ExclusiveStartKey.$": "$.LastEvaluatedKey" | |
}, | |
"Resource": "arn:aws:states:::aws-sdk:dynamodb:scan" | |
}, | |
"Map": { | |
"Type": "Map", | |
"Next": "Check for more", | |
"Iterator": { | |
"StartAt": "Process", | |
"States": { | |
"Process": { | |
"Type": "Pass", | |
"End": true | |
} | |
} | |
}, | |
"ItemsPath": "$.Items", | |
"ResultPath": null, | |
"MaxConcurrency": 40 | |
}, | |
"Check for more": { | |
"Type": "Choice", | |
"Choices": [ | |
{ | |
"Variable": "$.LastEvaluatedKey", | |
"IsPresent": true, | |
"Next": "Add new LastEvaluatedKey" | |
} | |
], | |
"Default": "Done" | |
}, | |
"Done": { | |
"Type": "Succeed" | |
}, | |
"Add new LastEvaluatedKey": { | |
"Type": "Pass", | |
"Next": "Scan", | |
"Parameters": { | |
"LastEvaluatedKey.$": "$.LastEvaluatedKey" | |
}, | |
"ResultPath": null | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment