在 AWS 管理控制台中代入另一个角色

Assume one role from another in the AWS management console

我在 IAM 中配置了两个角色“role1”和“role2”以及一个名为“foobar”的用户。配置“role2”的信任策略,以便“role1”被授予 AssumeRole 操作,而“role1”可以由 foobar 用户承担。

因此使用 role2 的工作流将以用户 foobar 身份登录,然后假设 role1 并从那里承担 role2.

我知道我可以通过在配置文件 ~/.aws/config 中设置 source_profile 值在 CLI 中轻松地从角色 1 跳转到角色 2。但是我一直无法在管理控制台(网络界面)中做同样的事情。有“切换角色”菜单,但它只允许我从未登录的用户中扮演角色,而不是从已经扮演的角色中扮演角色。

所以我的问题是:如何从管理控制台切换到上述场景中的“role2”?

我认为根据文档

,不允许来自 AWS 控制台的传递 IAM Role 切换

Granting a user permissions to switch roles

When you switch roles in the AWS Management Console, the console always uses your original credentials to authorize the switch. This applies whether you sign in as an IAM user, as a SAML-federated role, or as a web-identity federated role. For example, if you switch to RoleA, it uses your original user or federated role credentials to determine if you are allowed to assume RoleA. If you then try to switch to RoleB while you are using RoleA, your original user or federated role credentials are used to authorize your attempt, not the credentials for RoleA.