Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add a new key/value(dynamic) to the input (root path) of a StepFunction?

StepFunction's input is like:

{
  "name": "A",
  "address": "B"
}

How to add key/dynamic_value (like "executionId": "$$.Execution.Id") to root path:

{
  "name": "A",
  "address": "B",
  "executionId": "arn:aws:states:us-east-1:xxxx:execution:xxx-us-east-1:121b6750-5182-18eb-fd02-3b72c3e2f644"
}
like image 698
Echo Avatar asked Oct 25 '25 04:10

Echo


1 Answers

Currently there is no way to do so. They did not provide any syntax for overwriting. A workaround is using Parameters with an extra depth:

{
  "StartAt": "Task1",
  "States": {
    "Task1": {
      "Type": "Task",
      ...
      "Parameters": {
        "executionId.$": "$$.Execution.Id",
        "input.$": "$"
      },
      ...
    }
  }
}

and get output:

{
  "input": {
    "name": "A",
    "address": "B"
  },
  "executionId": "arn:aws:states:us-east-1:xxxx:execution:xxx-us-east-1:121b6750-5182-18eb-fd02-3b72c3e2f644"
}

References

  • https://states-language.net/spec.html
like image 190
chehsunliu Avatar answered Oct 26 '25 16:10

chehsunliu



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!