最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

amazon web services - How to pass extra paramter to Map Function in Aws State Machine - Stack Overflow

matteradmin4PV0评论

In AWS Step Functions, I need to perform a batch operation, so I am using Map. I am passing a token as an input parameter to the Step Function so it's accessible for the first Lambda (DEID-FF). However, from the DEID-FF Lambda, I am calling another Lambda, DEID-PARSER, but at that time, the token is not available to pass. How can I carry forward the input token to DEID-PARSER? I can't return the token inside the array of objects iterated through the map because the payload size is 256kb max.

I hardcoded currently token but need to make it dynamic.

{
  "Comment": "Workflow",
  "StartAt": "Fetch Documents",
  "States": {
    "Fetch Documents": {
      "Type": "Task",
      "Resource": "arn:aws:lambda:us-east-1:<YOUR_ACCOUNT_ID>:function:DEID-FF",
      "Parameters": {
        "person_id.$": "$.person_id",
        "request_id.$": "$.request_id",
        "token.$": "$.token"
      },
      "Next": "Check For Documents"
    },
    "Check For Documents": {
      "Type": "Choice",
      "Choices": [
        {
          "Variable": "$.body.hasDocuments",
          "BooleanEquals": true,
          "Next": "Parse Documents"
        }
      ],
      "Default": "No Documents"
    },
    "No Documents": {
      "Type": "Pass",
      "Parameters": {
        "caller": "No Documents"
      },
      "Next": "Update Stats NotRequired"
    },
    "Parse Documents": {
      "Type": "Map",
      "ItemsPath": "$.unprocessedDocumentIds",
      "Iterator": {
        "StartAt": "Process Document",
        "States": {
          "Process Document": {
            "Type": "Task",
            "Resource": "arn:aws:lambda:us-east-1:<YOUR_ACCOUNT_ID>:function:DEID-PARSER",
            "Parameters": {
              "person_id.$": "$.p_id",
              "request_id.$": "$.r_id",
              "document_ids.$": "$.d_id",
              "token": "<REDACTED_TOKEN>"
            },
            "End": true
          }
        }
      },
      "Next": "Consolidate Results"
    },
    "Consolidate Results": {
      "Type": "Task",
      "Resource": "arn:aws:lambda:us-east-1:<YOUR_ACCOUNT_ID>:function:DEID-CONSOLIDATOR",
      "Parameters": {
        "person_id.$": "$$.Execution.Input.person_id",
        "request_id.$": "$$.Execution.Input.request_id",
        "token": "<REDACTED_TOKEN>"
      },
      "Next": "Check Consolidated"
    },
    "Check Consolidated": {
      "Type": "Choice",
      "Choices": [
        {
          "Variable": "$.body.hasDocumentConsolidated",
          "BooleanEquals": true,
          "Next": "Replace PHI"
        }
      ],
      "Default": "No Consolidated"
    },
    "No Consolidated": {
      "Type": "Pass",
      "Parameters": {
        "caller": "No Consolidated"
      },
      "Next": "Update Stats NotRequired"
    },
    "Replace PHI": {
      "Type": "Map",
      "ItemsPath": "$.consolidatedDocumentIds",
      "Iterator": {
        "StartAt": "Replace Document",
        "States": {
          "Replace Document": {
            "Type": "Task",
            "Resource": "arn:aws:lambda:us-east-1:<YOUR_ACCOUNT_ID>:function:DEID-REPLACER",
            "Parameters": {
              "person_id.$": "$.p_id",
              "request_id.$": "$.r_id",
              "document_ids.$": "$.d_id",
              "token": "<REDACTED_TOKEN>"
            },
            "End": true
          }
        }
      },
      "Next": "Update Stats"
    },
    "Update Stats NotRequired": {
      "Type": "Task",
      "Resource": "arn:aws:lambda:us-east-1:<YOUR_ACCOUNT_ID>:function:DEID-FINALSTATS-NOTREQUIRED",
      "End": true
    },
    "Update Stats": {
      "Type": "Task",
      "Resource": "arn:aws:lambda:us-east-1:<YOUR_ACCOUNT_ID>:function:DEID-FINALSTATS",
      "End": true
    }
  }
}
Post a comment

comment list (0)

  1. No comments so far