担任访问角色 arn:aws:iam::1234 时出错:role/my-role
Error in assuming access role arn:aws:iam::1234:role/my-role
尝试使用 aws apprunner create-service --cli-input-json file://./myconfig.json
创建应用程序运行ner 服务时,出现标题错误:
An error occurred (InvalidRequestException) when calling the CreateService operation: Error in assuming access role arn:aws:iam::1234:role/my-role
我使用的 myconfig.json 与来自 AWS CreateService docs 的示例 json 非常相似,而且我认为它在这里不是特别相关。
错误似乎暗示我应该承担这个角色...但我已经从这个 :
中用这个命令承担了这个角色
eval $(aws sts assume-role --role-arn arn:aws:iam::1234:role/my-role --role-session-name apprunner-stuff1 --region us-east-1 | jq -r '.Credentials | "export AWS_ACCESS_KEY_ID=\(.AccessKeyId)\nexport AWS_SECRET_ACCESS_KEY=\(.SecretAccessKey)\nexport AWS_SESSION_TOKEN=\(.SessionToken)\n"')
这 运行s 没有错误 & 当我 运行:
aws sts get-caller-identity
它输出我认为正确的以下内容:
{
"UserId": "SOME1234NPC:apprunner-stuff1",
"Account": "1234",
"Arn": "arn:aws:sts::1234:assumed-role/my-role/apprunner-stuff1"
}
此时,错误消息没有意义,我想知道我做错了什么愚蠢的 IAM 事情?
App运行 更具体 - 我试图给 my-role 从 AppRunner IAM doc 到 运行 CreateService 的所有权限,但我很容易错过一些。此处的错误消息似乎并不表示该角色没有足够的权限,但可能是相关的。
而不是尝试在 IAM doc permissions, I followed the UI AppRunner guide here 之后创建角色。这创建了一个自动命名为 AppRunnerECRAccessRole 的角色。我在 json 配置中将该角色用作我的 AccessRoleArn,使 json 配置部分看起来像:
"AuthenticationConfiguration": {
"AccessRoleArn": "arn:aws:iam::12345:role/service-role/AppRunnerECRAccessRole"
},
我按照此 允许我的用户/组承担 AppRunnerECRAccessRole,并将策略应用于 user/group,例如:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"sts:AssumeRole"
],
"Resource": [
"arn:aws:iam::12345:role/my-role",
"arn:aws:iam::12345:role/service-role/AppRunnerECRAccessRole"
]
}
]
}
在此之后我能够 运行:
aws apprunner create-service --cli-input-json file://./myconfig-with-ui-role-arn.json
& 成功了! (甚至没有通过 eval 命令承担角色)。尽管我授予用户对这两个角色的访问权限,但创建只能通过新的 AppRunnerECRAccessRole 角色进行。所以我认为外卖/主要答案是通过 UI 创建一个 AppRunner 服务,然后重用它的服务角色。
尝试使用 aws apprunner create-service --cli-input-json file://./myconfig.json
创建应用程序运行ner 服务时,出现标题错误:
An error occurred (InvalidRequestException) when calling the CreateService operation: Error in assuming access role arn:aws:iam::1234:role/my-role
我使用的 myconfig.json 与来自 AWS CreateService docs 的示例 json 非常相似,而且我认为它在这里不是特别相关。
错误似乎暗示我应该承担这个角色...但我已经从这个
eval $(aws sts assume-role --role-arn arn:aws:iam::1234:role/my-role --role-session-name apprunner-stuff1 --region us-east-1 | jq -r '.Credentials | "export AWS_ACCESS_KEY_ID=\(.AccessKeyId)\nexport AWS_SECRET_ACCESS_KEY=\(.SecretAccessKey)\nexport AWS_SESSION_TOKEN=\(.SessionToken)\n"')
这 运行s 没有错误 & 当我 运行:
aws sts get-caller-identity
它输出我认为正确的以下内容:
{
"UserId": "SOME1234NPC:apprunner-stuff1",
"Account": "1234",
"Arn": "arn:aws:sts::1234:assumed-role/my-role/apprunner-stuff1"
}
此时,错误消息没有意义,我想知道我做错了什么愚蠢的 IAM 事情?
App运行 更具体 - 我试图给 my-role 从 AppRunner IAM doc 到 运行 CreateService 的所有权限,但我很容易错过一些。此处的错误消息似乎并不表示该角色没有足够的权限,但可能是相关的。
而不是尝试在 IAM doc permissions, I followed the UI AppRunner guide here 之后创建角色。这创建了一个自动命名为 AppRunnerECRAccessRole 的角色。我在 json 配置中将该角色用作我的 AccessRoleArn,使 json 配置部分看起来像:
"AuthenticationConfiguration": {
"AccessRoleArn": "arn:aws:iam::12345:role/service-role/AppRunnerECRAccessRole"
},
我按照此
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"sts:AssumeRole"
],
"Resource": [
"arn:aws:iam::12345:role/my-role",
"arn:aws:iam::12345:role/service-role/AppRunnerECRAccessRole"
]
}
]
}
在此之后我能够 运行:
aws apprunner create-service --cli-input-json file://./myconfig-with-ui-role-arn.json
& 成功了! (甚至没有通过 eval 命令承担角色)。尽管我授予用户对这两个角色的访问权限,但创建只能通过新的 AppRunnerECRAccessRole 角色进行。所以我认为外卖/主要答案是通过 UI 创建一个 AppRunner 服务,然后重用它的服务角色。