IAM PassRole 限制
IAM PassRole restrictions
我需要在创建 CF 时将执行角色传递给 Lambda 的权限。
所以我给了用于创建 CF 的角色:
Effect: Allow
Action:
- iam:PassRole
Resource:
- "myexecutionrole"
所以现在我的CF角色可以将执行角色传递给任何资源。我想限制这个。我希望它只能将角色传递给它所针对的 Lambda 函数。所以我一直在研究政策条件,放在这里我只找到限制呼叫源而不是目标的解决方案。
这是我想要的吗?如何实现?
您可以使用 iam:AssociatedResourceArn
。来自 docs:
Specifies the ARN of the resource to which this role will be associated at the destination service.
我需要在创建 CF 时将执行角色传递给 Lambda 的权限。 所以我给了用于创建 CF 的角色:
Effect: Allow
Action:
- iam:PassRole
Resource:
- "myexecutionrole"
所以现在我的CF角色可以将执行角色传递给任何资源。我想限制这个。我希望它只能将角色传递给它所针对的 Lambda 函数。所以我一直在研究政策条件,放在这里我只找到限制呼叫源而不是目标的解决方案。 这是我想要的吗?如何实现?
您可以使用 iam:AssociatedResourceArn
。来自 docs:
Specifies the ARN of the resource to which this role will be associated at the destination service.