我有一个step函数,它应该调用API Gateway资源而不是lambda。这样做的语法是什么?
{"Comment": "A Hello World example of the Amazon States Language using a Pass state",
"StartAt": "QueueProducts",
"States": {
"GetProductsFromDb": {
"Type": "Task",
"Resource":"some-lambda",
"Next": "InvokeAPIGatewayWorkers"
}
},
"InvokeAPIGatewayWorkers":{
"Type": "Parallel",
"Branches": [
....]
}
}
我的问题是,是否可以在资源中调用API网关而不是" some-lamda"
答案 0 :(得分:1)
不,这是不可能的。
您必须使用Lambda函数来调用API网关。
答案 1 :(得分:0)
2020年11月11日发布的更新使从Step Functions调用API网关资源成为可能。
在上述定义中,如果调用了API网关资源,则代替some-lambda
的定义如下:
{
"Comment": "An example of calling an API Gateway Resouce from one of the states of Step Function",
"StartAt": "QueueProducts",
"States": {
"GetProductsFromDb": {
"Type": "Task",
"Resource": "arn:aws:states:::apigateway:invoke",
"Parameters": {
"ApiEndpoint": "{{api_gateway_id}}.execute-api.{{aws_region}}.amazonaws.com",
"Method": "GET",
"Headers": {
"session_id.$": "States.Array($.token)"
},
"Stage": "prod",
"Path": "products",
"QueryParameters": {
"category.$": "States.Array($.category)"
}
},
"ResultSelector": {
"ProductList.$": "$.ResponseBody"
},
"Next": "InvokeAPIGatewayWorkers"
}
},
"InvokeAPIGatewayWorkers": {
"Type": "Parallel",
"Branches": []
}
}
Documentation 注意:请注意不允许的标题