アイデンティティベースのポリシーの設定例 - AWS Systems Manager

AWS Systems Manager Change Manager は新規顧客に公開されなくなりました。既存のお客様は、通常どおりサービスを引き続き使用できます。詳細については、「AWS Systems Manager Change Manager の可用性の変更」を参照してください。

アイデンティティベースのポリシーの設定例

以下のセクションでは、AWS Systems Manager Automation サービスの IAM アイデンティティベースのポリシーの例を示します。これらの JSON ポリシードキュメント例を使用して IAM の ID ベースのポリシーを作成する方法の詳細については、IAM ユーザーガイドの「Creating IAM policies」を参照してください。

注記

すべての例では架空のアカウント ID が使用されています。AWS 所有のパブリックドキュメントでは、Amazon リソースネーム (ARN) でアカウント ID は指定されていません。

例 1: ユーザーがオートメーションドキュメントを実行してオートメーション実行を表示することを許可する

次の IAM ポリシーの例では、ユーザーに次の操作を許可します。

  • ポリシーで指定されたオートメーションドキュメントの実行 ドキュメント名は次のエントリによって決定します。

    arn:aws:ssm:*:111122223333:document/{{DocumentName}}
  • オートメーション実行の停止とシグナル送信

  • オートメーション実行の開始後のオートメーション実行の詳細の表示

JSON
{ "Version":"2012-10-17", "Statement": [ { "Action": "ssm:StartAutomationExecution", "Effect": "Allow", "Resource": [ "arn:aws:ssm:*:111122223333:document/{{DocumentName}}", "arn:aws:ssm:*:111122223333:automation-execution/*" ] }, { "Action": [ "ssm:StopAutomationExecution", "ssm:GetAutomationExecution", "ssm:DescribeAutomationExecutions", "ssm:DescribeAutomationStepExecutions", "ssm:SendAutomationSignal" ], "Resource": [ "arn:aws:ssm:*:111122223333:automation-execution/*" ], "Effect": "Allow" } ] }

例 2: ユーザーが特定のバージョンのオートメーションドキュメントを実行することを許可する

次の IAM ポリシーの例では、オートメーションドキュメントの特定のバージョンの実行をユーザーに許可します。

  • オートメーションドキュメントの名前は次のエントリによって決定します。

    arn:aws:ssm:*:111122223333:document/{{DocumentName}}
  • オートメーションドキュメントのバージョンは次のエントリによって決定します。

    "ssm:DocumentVersion": "5"
JSON
{ "Version":"2012-10-17", "Statement": [ { "Action": "ssm:StartAutomationExecution", "Effect": "Allow", "Resource": [ "arn:aws:ssm:*:111122223333:document/{{DocumentName}}" ], "Condition": { "ForAnyValue:StringEquals": { "ssm:DocumentVersion": ["5"] } } }, { "Action": [ "ssm:StartAutomationExecution" ], "Resource": [ "arn:aws:ssm:*:111122223333:automation-execution/*" ], "Effect": "Allow" }, { "Action": [ "ssm:StopAutomationExecution", "ssm:GetAutomationExecution", "ssm:DescribeAutomationExecutions", "ssm:DescribeAutomationStepExecutions", "ssm:SendAutomationSignal" ], "Resource": [ "arn:aws:ssm:*:111122223333:automation-execution/*" ], "Effect": "Allow" } ] }

例 3: ユーザーが特定のタグを使用してオートメーションドキュメントを実行することを許可する

次の IAM ポリシーの例では、特定のタグを持つオートメーションドキュメントの実行をユーザーに許可します。

  • オートメーションドキュメントの名前は次のエントリによって決定します。

    arn:aws:ssm:*:111122223333:document/{{DocumentName}}
  • ドキュメントのタグは次のエントリによって決定します。

    "ssm:DocumentVersion": "5"
JSON
{ "Version":"2012-10-17", "Statement": [ { "Action": "ssm:StartAutomationExecution", "Effect": "Allow", "Resource": [ "arn:aws:ssm:*:111122223333:document/*" ], "Condition": { "StringEquals": { "aws:ResourceTag/stage": "production" } } }, { "Action": [ "ssm:StartAutomationExecution" ], "Resource": [ "arn:aws:ssm:*:111122223333:automation-execution/*" ], "Effect": "Allow" }, { "Action": [ "ssm:StopAutomationExecution", "ssm:GetAutomationExecution", "ssm:DescribeAutomationExecutions", "ssm:DescribeAutomationStepExecutions", "ssm:SendAutomationSignal" ], "Resource": [ "arn:aws:ssm:*:111122223333:automation-execution/*" ], "Effect": "Allow" } ] }

例 4: 自動化の実行に特定のタグパラメータが指定されている場合にユーザーがオートメーションドキュメントを実行することを許可する

次の例では、IAM ポリシーは、特定のタグパラメータがオートメーション実行に指定されている場合にオートメーションドキュメントを実行するアクセス許可をユーザーに付与します。

  • ポリシーで指定されたオートメーションドキュメントの実行 ドキュメント名は次のエントリによって決定します。

    arn:aws:ssm:*:111122223333:document/{{DocumentName}}
  • オートメーション実行に特定のタグパラメータを指定する必要があります。オートメーション実行リソースのタグパラメータは、次のエントリによって決まります。

    "aws:ResourceTag/stage": "production"
  • 指定されたタグがあるオートメーション実行の停止とシグナルの送信。

  • 指定されたタグがあるオートメーション実行の詳細の表示。

  • 指定されたタグを SSM リソースにタグの追加。

JSON
{ "Version":"2012-10-17", "Statement": [ { "Action": "ssm:StartAutomationExecution", "Effect": "Allow", "Resource": [ "arn:aws:ssm:*:111122223333:document/{{DocumentName}}" ] }, { "Action": [ "ssm:StartAutomationExecution", "ssm:StopAutomationExecution", "ssm:GetAutomationExecution", "ssm:DescribeAutomationExecutions", "ssm:DescribeAutomationStepExecutions", "ssm:SendAutomationSignal" ], "Resource": [ "arn:aws:ssm:*:111122223333:automation-execution/*" ], "Effect": "Allow", "Condition": { "StringEquals": { "aws:ResourceTag/environment": "beta" } } }, { "Action": "ssm:AddTagsToResource", "Effect": "Allow", "Resource": [ "arn:aws:ssm:*:111122223333:automation-execution/*" ] } ] }