AWS Step Functions - 将输入传递给另一个任务
AWS Step Functions - Pass input to another task
如何在 AWS Step Functions 的 task
中将输入传递到输出?
我知道 和文档:
If the value of ResultPath is null, that means that the state’s own raw output is discarded and its raw input becomes its result.
但我需要的是:
- 根据我的意见
{
"input": "my_input"
}
- 还有我的 lambda 输出
{
"output": "my_output"
}
我需要将以下内容传递给下一个状态 json:
{
"input": "my_input",
"output": "my_output"
}
我想到了两个建议,Use ResultPath to Replace the Input with the Result,这样您就可以
If you don't specify a ResultPath, the default behavior is as if you had specified "ResultPath": "$"
. Because this tells the state to replace the entire input with the result, the state input is completely replaced by the result coming from the task result.
要使此选项起作用,Lambda 函数必须return 所需的响应:
{
"input": "my_input",
"output": "my_output"
}
或者在 Step Functions 开发人员指南中 Use ResultPath to Include the Result with the Input。接下来,如果您将 Lambda 的 return 值更改为只包含 "my_output"
,您可以指定 "ResultPath": "$.output"
以获得所需的结果:
{
"input": "my_input",
"output": "my_output"
}
对于任何遇到这个问题的人来说,不可能按照我的要求去做,但是你可以做的是,according to the docs:
{
"States": {
"my-state": {
"Type": "task",
"ResultPath": "$.response"
}
}
}
这会将任何 lambda returns 附加到 response
节点中,结果是:
{
"input": "my_input",
"response": {
"output": "my_output"
}
}
如何在 AWS Step Functions 的 task
中将输入传递到输出?
我知道
If the value of ResultPath is null, that means that the state’s own raw output is discarded and its raw input becomes its result.
但我需要的是:
- 根据我的意见
{
"input": "my_input"
}
- 还有我的 lambda 输出
{
"output": "my_output"
}
我需要将以下内容传递给下一个状态 json:
{
"input": "my_input",
"output": "my_output"
}
我想到了两个建议,Use ResultPath to Replace the Input with the Result,这样您就可以
If you don't specify a ResultPath, the default behavior is as if you had specified
"ResultPath": "$"
. Because this tells the state to replace the entire input with the result, the state input is completely replaced by the result coming from the task result.
要使此选项起作用,Lambda 函数必须return 所需的响应:
{
"input": "my_input",
"output": "my_output"
}
或者在 Step Functions 开发人员指南中 Use ResultPath to Include the Result with the Input。接下来,如果您将 Lambda 的 return 值更改为只包含 "my_output"
,您可以指定 "ResultPath": "$.output"
以获得所需的结果:
{
"input": "my_input",
"output": "my_output"
}
对于任何遇到这个问题的人来说,不可能按照我的要求去做,但是你可以做的是,according to the docs:
{
"States": {
"my-state": {
"Type": "task",
"ResultPath": "$.response"
}
}
}
这会将任何 lambda returns 附加到 response
节点中,结果是:
{
"input": "my_input",
"response": {
"output": "my_output"
}
}