0

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?

2 Answers 2

2

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).

Sign up to request clarification or add additional context in comments.

Comments

2

You are now able to call DynamoDB directly from step functions. This includes the query and scan operations. With the result, you can then iterate through the items. The one less convenient, caveat is that it does not use the document client, so the results are in the dynamodb json format.

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.