当尝试通过 AWS CLI 执行“承担角色”时,为什么“botocore-session-id#”会附加到我的 Amazon 资源编号 (arn:)

问题描述 投票:0回答:1

到目前为止我已经能够顺利运行

aws sts assume-role --role-arn arn:aws:iam::<accountID>:role/<iam_role> --role-session-name <a_session_name> --profile <the_profile_name>
...

现在我收到错误

An error occurred (AccessDenied) when calling the AssumeRole operation: User: arn:aws:sts::<accountID>:assumed-role/<iam_role>/botocore-session-xxxxx is not authorized to perform: sts:AssumeRole on resource: arn:aws:iam::<accountId>:role/<iam_role>

这是因为我处于假设角色状态然后尝试再次假设相同角色吗?如果是这种情况那么清除 botocore 缓存的解决方案是什么?

  • 我已经清除了~/.aws/cache目录
  • 直到今天我已经成功担任此角色,没有从我的 AWS 账户中删除任何安全凭证
  • 我已经终止并重述了 iTerm 会话
  • 执行
    aws sts get-caller-identity --profile picklerick
    给我带来了相同的结果:
    arn:
    userId
    都附加了相同的
    botocore-session-xxxxx

这些问题不是这个问题的重复:

  1. 通过 boto3 承担 IAM 用户角色时访问被拒绝
  2. AWS cli:无权对资源执行:sts:AssumeRole
  3. python boto3 错误:无权在资源上执行假定角色

如果这些对你来说有意义,那么你也可以首先解释一下是什么原因造成的 - 到目前为止我没有遇到任何问题,从来没有关心或看到过 boto 的提及

amazon-web-services aws-cli botocore
1个回答
0
投票

我认为这里的问题是 IAM 角色不再隐式信任自己,因此您需要调整信任策略以将角色本身添加到列表中。对于和我有同样问题的人,你可以阅读以下博客文章。

https://aws.amazon.com/blogs/security/announcing-an-update-to-iam-role-trust-policy-behavior/

© www.soinside.com 2019 - 2024. All rights reserved.