我想根据上一步的结果动态选择一个AWS Lambda工作者。像{"Resource": "$.worker_arn"}
之类的东西。
"RunWorkers": {
"Type": "Map",
"MaxConcurrency": 0,
"InputPath": "$.output",
"ResultPath": "$.raw_result",
"Iterator": {
"StartAt": "CallWorkerLambda",
"States": {
"CallWorkerLambda": {
"Type": "Task",
"Resource": "$$.worker_arn",
"End": true
}
}
},
"Next": "Aggregate"
},
预期上一步的输入如下:
[{"worker_arn":..., "output":1}, {"worker_arn":..., "output":1}, ...]
,
worker_arn
在所有工作人员中都相同。
当我编写这样的管道时,短绒棉条抱怨它需要ARN。
有没有比将我的工人lambda包装到另一个lambda中更好的选择了?
答案 0 :(得分:1)
使用"Resource": "arm:aws:states:::lambda:invoke"
,您可以在运行时使用路径在"FunctionName"
中设置"Parameters"
字段。
{
"StartAt":"CallLambda",
"States":{
"CallLambda":{
"Type":"Task",
"Resource": "arn:aws:states:::lambda:invoke",
"Parameters":{
"FunctionName.$":"$.MyFunction",
"Payload.$": "$"
},
"End":true
}
}
}
https://docs.aws.amazon.com/step-functions/latest/dg/connect-lambda.html