我使用Service来执行SSM自动化文档,所以我的Service有自己的角色"My_END_USER_Role",并且我已经创建了另一个角色,允许停止SSM自动化文档的EC2。
My_END_USER_Role这个角色有AWSServiceCatalogEndUserFullAccess,简单的解决方案是直接给这个角色我需要的权限,但是我不想让用户退出服务目录,做任何像停止EC2这样的操作,所以我想假设MY_SSM_ROLE有额外的权限,但是我得到了这个错误
An error occurred (InvalidAutomationExecutionParametersException) when calling the StartAutomationExecution operation: The defined assume role is unable to be assumed.基于AWS故障排除-无法承担部分承担的角色或者是不存在的角色对我来说是不真实的,或者假定的角色与系统管理器服务没有信任关系,现在我被困在这里,我该如何给予信任关系!
SSM自动化文档
description: Stop EC2 Instance
schemaVersion: '0.3'
assumeRole: '{{ AutomationAssumeRole }}'
parameters:
AutomationAssumeRole:
type: String
default: 'arn:aws:iam::ACCOUNTID:role/MY_SSM_ROLE'
description: The ARN of the role that allows Automation to perform the actions on your behalf.
InstanceId:
type: 'AWS::EC2::Instance::Id'
mainSteps:
- name: StopInstance
action: 'aws:changeInstanceState'
inputs:
InstanceIds:
- '{{ InstanceId }}'
DesiredState: stopped为了进行测试,我给了MY_SSM_ROLE管理权限,并且还包括了以下策略:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"sts:AssumeRole",
"iam:PassRole",
"ssm:StartAutomationExecution"
],
"Resource": "*"
}
]
}发布于 2021-11-10 13:53:34
找到解决方案后,我必须向信任关系添加一个适当的服务,用于MY_SSM_ROLE角色。
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": [
"ssm.amazonaws.com",
"iam.amazonaws.com"
]
},
"Action": "sts:AssumeRole"
}
]
}https://stackoverflow.com/questions/69913355
复制相似问题