Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/amazon-web-services/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Amazon web services 未被授权在资源上执行:sts:AssumeRole_Amazon Web Services_Amazon Iam - Fatal编程技术网

Amazon web services 未被授权在资源上执行:sts:AssumeRole

Amazon web services 未被授权在资源上执行:sts:AssumeRole,amazon-web-services,amazon-iam,Amazon Web Services,Amazon Iam,我正在尝试使用kubectl处理由其他用户创建的EKS集群。 我按照中的不同说明,使用以下命令创建kube配置文件:aws eks--region eu-central-1 update kubeconfig--name internal--role arn arn:aws:iam::XXXXXXXXXXXXX:role/eks_role_internal 然后,当我尝试测试配置时(kubectl get svc),我得到了错误: could not get token: AccessDenie

我正在尝试使用kubectl处理由其他用户创建的EKS集群。 我按照中的不同说明,使用以下命令创建kube配置文件:
aws eks--region eu-central-1 update kubeconfig--name internal--role arn arn:aws:iam::XXXXXXXXXXXXX:role/eks_role_internal

然后,当我尝试测试配置时(
kubectl get svc
),我得到了错误:

could not get token: AccessDenied: User: arn:aws:iam::xxxxxxxxxxxx:user/me is not authorized to perform: sts:AssumeRole on resource: arn:aws:iam::xxxxxxxxxxxxx:role/eks_role_internal
以下是策略的配置:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "VisualEditor0",
            "Effect": "Allow",
            "Action": "sts:AssumeRole",
            "Resource": "arn:aws:iam::xxxxxxxxxxx:role/eks_role_internal"
        }
    ]
}
以及角色的信任关系:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Principal": {
        "Service": [
          "eks.amazonaws.com",
          "ec2.amazonaws.com"
        ]
      },
      "Action": "sts:AssumeRole"
    }
  ]
}

获取此错误消息的第一个原因是在将要承担的角色上错误配置了信任关系

当信任关系中附加的拥有MFA的条件不满足时,我也看到了这个错误:

"Condition": {"Bool": {"aws:MultiFactorAuthPresent": true}}

AWS
cli
不够聪明,无法看到此案例并请求MFA代码,它只是抛出错误消息。

您的策略是否附加了哪个角色?在我的策略的“策略使用”选项卡中,我有我的用户和角色(eks_role_internal),错误消息表明您的用户无权担任该角色。您是否可以更新IAM角色的信任关系以同时包含该用户并重试?