【问题标题】:Returning custom response from AWS Step Functions从 AWS Step Functions 返回自定义响应
【发布时间】:2021-08-27 09:25:57
【问题描述】:

我怎样才能像这样配置 Amazon API Gateway 和 AWS Step Functions?

客户端在 api 网关上调用 api ==> Api Gateway ===> Step Function ===> 内部调用 lambda => lambda 返回响应 ==> 响应被发送回 api 网关。

现在,我的 Amazon API Gateway 不是直接调用 AWS Step Functions,而是调用一个 lambda,该 lambda 调用 step 函数并检查其成功状态,然后将响应返回给 Amazon API Gateway。

【问题讨论】:

    标签: amazon-web-services aws-api-gateway aws-step-functions


    【解决方案1】:

    使用 Step Functions Express Workflows,您可以直接从 API Gateway 启动同步执行,并在完成时返回结果。如果您的工作流程可以在 API Gateway 超时内完成,这可能是最好的选择。

    https://aws.amazon.com/blogs/compute/new-synchronous-express-workflows-for-aws-step-functions/

    如果使用异步执行,直接 API Gateway -> Step Functions 集成将不会返回工作流的最终输出或返回 Lambda 函数的响应。

    【讨论】:

      【解决方案2】:

      StartExecution API 是异步的。调用此 API 时必须调用DescribeExecution API 才能得到结果。

      因此,StartSyncExecution API 与 Express 类型状态机一起使用,允许您同步调用 Step Functions。最长持续时间为 5 分钟。

      【讨论】:

        猜你喜欢
        • 2022-09-23
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2020-09-05
        • 2020-01-29
        • 1970-01-01
        • 2022-12-21
        • 2019-10-28
        相关资源
        最近更新 更多