0
votes

Just what the title says, basically. I have read through the documentation:

https://docs.aws.amazon.com/step-functions/latest/dg/connect-ddb.html

This describes how to get a single item of information out of a DynamoDB table from a step function. What I would like to do is iterate through the entire table and start execution of another state machine for each item. Each new state machine would have an individual item as input. I have attempted the following code, which unfortunately is not functional:

{
  "StartAt": "OuterFunction",
  "States": {
    "OuterFunction": {
      "Type": "Map",
      "Iterator": {
        "StartAt": "InnerFunction",
        "States": {
          "InnerFunction": {
            "Type": "Task",
            "Resource": "arn:aws:states:::dynamodb:getItem.sync",
            "Parameters": {
              "StateMachineArn":"other-state-machine-arn",
              "TableName": "TestTable"
            },
            "End": true
          }
        }
      },
      "End": true
    }
  }
}

Is it actually possible to iterate through a DynamoDB table in this way?

1

1 Answers

1
votes

No, getItem is designed to fetch particular DynamoDB document. You need to write custom Lambda that will .query() or .scan() your table and then use Map step to iterate over results (most likely you won't need getItem at that time, because you can load all data with the query/scan operation).