サービス カタログを使用して SSM 自動化ドキュメントを実行しているため、サービス カタログには「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 トラブルシューティングに基づく - セクション ロールを想定できない ロールが存在しないか、それは私には当てはまりません または ロールを引き受けると、Systems Manager サービスとの信頼関係がありません。信頼関係!?
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": "*"
}
]
}