在AWS Step Function的Choice步骤中,我们希望将AWS Lambda函数的结果与使用“ NumericGreaterThan”作为参数给出的阈值进行比较。
在我们的示例中,我们将根据lambda计算出的结果与事件给出的阈值进行了比较。
我尝试通过以下方式定义步进函数:
{
"StartAt": "Check Enough Data","States": {
"Check Enough Data": {
"Type": "Task","Resource": "arn:aws:lambda:REGION:ID:function:FUNCTION:$LATEST","Next": "Validate Count","ResultPath": "$.count"
},"Validate Count": {
"Type": "Choice","Choices": [
{
"Variable": "$.count","NumericGreaterThan": "$.threshold","Next": "Succeed State"
}
],"Default": "Wait 24 Hours"
},"Wait 24 Hours": {
"Type": "Wait","Seconds": 86400,"Next": "Check Enough Data"
},"Succeed State": {
"Type": "Succeed"
}
}
}
但出现错误类型的预期值:Integer,Float插入了String 。 如果我将“ $ .threshold”替换为硬编码的值(如20),则可以使用,但是该值不是我想要的动态值。
以下输入应使lambda进入成功状态:
{
"country": "japan","threshold": 40
}
我知道我们可以用另一个Lambda函数代替“选择”步骤,但是我们不想从具有成本效益的问题中做到这一点。
有人对解决问题有想法吗?