角色信任关系策略中的 AssumeRole 操作

AssumeRole Action in a Role's Trust Relationship Policy

根据 AWS 文档,

A user who wants to access a role in a different account must also have permissions that are delegated from the user account administrator. The administrator must attach a policy that allows the user to call AssumeRole for the ARN of the role in the other account.

我理解这个要求。但是,我不确定为什么仍然需要在角色的 'Trust Relationship' 中再次指定 'AssumeRole' 操作。 allow/restrict 委托人(使用 'AssumeRole' 操作)承担特定角色并且被承担的角色信任假设委托人(在其 'Trust Relationship' 中)是有意义的,但不确定为什么角色本身必须在其信任关系中指定 'AssumeRole' 操作。这些角色总是可以承担的——不是吗?或者,在角色的 'Trust relationship' 中指定 'AssumeRole' 操作的意义是什么?

我不是 AWS 角色专家,但据我所知,信任关系政策文档之所以有意义,主要有两个原因:

  1. 一个角色不仅可以用sts:AssumeRole动作,还可以用sts:AssumeRoleWithSAMLsts:AssumeRoleWithWebIdentity(docs here).

  2. 顾名思义"Trust Relationship Policy Document",也是一份政策文件。因此,AWS 没有为信任关系创建不同的模板,而是创建了一个策略模板并在所有情况下使用它——这样我们只需要学习一次策略模板 (docs here).