我正在使用使用 AWS Control Tower 和 AWS Organization 的多账户架构。我有一个主账户,其中有一个名为 agent 的 IAM 用户(没有附加策略,只有 CLI 访问权限),然后我有另一个名为 dev 的 AWS 账户,我在其中创建了一个名为工作负载部署的新角色(ARN -> arn :aws:iam::809348927750:role/workload-deployer) 具有以下信任关系:-
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::185288728304:user/agent"
},
"Action": "sts:AssumeRole",
"Condition": {}
}
]
}
当我尝试担任此角色时,出现以下错误:-
An error occurred (AccessDenied) when calling the AssumeRole operation: User: arn:aws:iam::185288728304:user/agent is not authorized to perform: sts:AssumeRole on resource: arn:aws:iam::809348927750:role/workload-deployer
我正在运行以承担角色的命令:-
aws sts assume-role --role-arn arn:aws:iam::809348927750:role/workload-deployer --role-session-name "RoleSession1" --duration-seconds 900 --profile zm
答案 0 :(得分:2)
为了承担一个角色,您需要在 2 个地方存在权限:
sts:AssumeRole
权限的策略。听起来您没有获得 #1 的权限。