首页 > 解决方案 > 来自 Step Function 的跨账户 Lambda 调用

问题描述

我在帐户 A 中有 Step Function,它在帐户 B 中有 lambda。但是在运行 step 函数时,它给出:

An error occurred while executing the state 'lambdaB' (entered at the event id #2). The resource belongs to a different account from the running execution.

有什么办法可以进行这种配置。

标签: amazon-web-servicesaws-lambdaamazon-iamaws-step-functions

解决方案


AWS Step Functions 不能(直接)调用不同账户中的 AWS Lambda 函数。

一种解决方法是调用调用AssumeRole()账户 B 中的 IAM 角色的 Lambda 函数,然后使用返回的凭证调用账户 B 中的 Lambda 函数。

或者,使用账户 B 中的 API Gateway 以允许从外部源触发 Lambda 函数。


推荐阅读