Skip to content

Instantly share code, notes, and snippets.

@half2me
Created September 14, 2022 10:27
Show Gist options
  • Save half2me/9da73ccc7a1be410e7c8ca843ee9b856 to your computer and use it in GitHub Desktop.
Save half2me/9da73ccc7a1be410e7c8ca843ee9b856 to your computer and use it in GitHub Desktop.

Revisions

  1. half2me created this gist Sep 14, 2022.
    64 changes: 64 additions & 0 deletions stepfunction.json
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,64 @@
    {
    "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
    }
    }
    }