【发布时间】:2021-07-21 10:08:04
【问题描述】:
我有几个 AWS CodeBuild 项目使用 Use-STSRole 到 Assume Role 的更特权角色 (readwrite) 以便从 Secrets Manager 中读取密钥。
我已将readwrite 角色的信任关系配置为:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": "codebuild.amazonaws.com"
},
"Action": "sts:AssumeRole"
}
]
}
当我的 CodeBuild 项目运行时出现错误:
Use-STSRole: C:\example-stack-overflow-question\common\utility.psm1:6
Line |
6 | Use-STSRole -RoleArn $RoleArn -RoleSessionName $RoleSessionName | …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| User:
| arn:aws:sts::112233445566:assumed-role/aws-lambda-dotnet-powershe-SignProjectRole5EF6D320-X2IF2P0P1J4/AWSCodeBuild-0d189fc5-f3b6-440a-bed6-ab54ed5f6c08
| is not authorized to perform: sts:AssumeRole on resource: arn:aws:iam::112233445566:role/readwrite
如何配置我的 IAM 角色 readwrite 以允许任何 CodeBuild 项目通过 Use-STSRole 担任该角色?
【问题讨论】:
标签: amazon-web-services amazon-iam aws-codebuild aws-powershell