我需要从主帐户中承担次要帐户中的临时角色。对于主帐户,我已经有了一个角色,它为次要角色中的临时角色提供了一个假定角色策略。但是当我执行命令时
aws sts assume-role --role-arn ${primaryRoleArn} --role-session-name ${awsProfile}我收到了这个错误
An error occurred (AccessDenied) when calling the AssumeRole operation: User: arn:aws:iam::xxxxxxx:user/primary is not authorized to perform: sts:AssumeRole on resource: arn:aws:iam::secondaryAccount:role/secondary_role我做错什么了?
发布于 2022-04-11 15:17:00
必须显式地允许~/..aws/凭据文件中的凭据承担此角色。因此,在主要角色信任策略中,必须将用户名添加到允许的假设中。
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::${AccountId}:user/${AwsUserName}"
},
"Action": "sts:AssumeRole"
}
]https://stackoverflow.com/questions/64807569
复制相似问题