

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

# Fargate の自動セキュリティエージェントの管理 (Amazon ECS のみ)
<a name="managing-gdu-agent-ecs-automated"></a>

Runtime Monitoring は、GuardDuty を介してのみ Amazon ECS クラスター (AWS Fargate) のセキュリティエージェントの管理をサポートします。Amazon ECS クラスターでのセキュリティエージェントの手動管理はサポートされていません。

このセクションのステップに進む前に、必ず「[AWS Fargate (Amazon ECS のみ) サポートの前提条件](prereq-runtime-monitoring-ecs-support.md)」に従ってください。

「[Amazon ECS-Fargate リソースで GuardDuty セキュリティエージェントを管理するためのアプローチ](how-runtime-monitoring-works-ecs-fargate.md#gdu-runtime-approaches-agent-deployment-ecs-clusters)」に応じて、リソースの GuardDuty 自動エージェントを有効にする任意の方法を選択します。

**Topics**

## マルチアカウント環境用の GuardDuty エージェントの設定
<a name="ecs-fargate-manage-agent-multiple-accounts"></a>

マルチアカウント環境では、委任 GuardDuty 管理者アカウントのみが、メンバーアカウントの自動エージェント設定を有効または無効にすることや、組織内のメンバーアカウントに属する Amazon ECS クラスターの自動エージェント設定を管理することができます。GuardDuty メンバーアカウントからは、この設定を変更できません。委任 GuardDuty 管理者アカウントは、 を使用してメンバーアカウントを管理します AWS Organizations。マルチアカウント環境の詳細については、「[GuardDuty での複数のアカウントの管理](https://docs.aws.amazon.com/guardduty/latest/ug/guardduty_accounts.html)」を参照してください。

### 委任 GuardDuty 管理者アカウントの自動エージェント設定の有効化
<a name="ecs-enable-automated-agent-config-delegatedadmin"></a>

------
#### [ Manage for all Amazon ECS clusters (account level) ]

Runtime Monitoring の **[すべてのアカウントについて有効にする]** を選択した場合、次のオプションがあります。
+ [自動エージェント設定] セクションで **[すべてのアカウントについて有効にする]** を選択します。GuardDuty は、起動されるすべての Amazon ECS タスクについてセキュリティエージェントをデプロイして管理します。
+ **[アカウントを手動で設定]** を選択します。

[Runtime Monitoring] セクションで **[アカウントを手動で設定]** を選択した場合、次の操作を行います。

1. [自動エージェント設定] セクションで **[アカウントを手動で設定する]** を選択します。

1. **[委任 GuardDuty 管理者 (このアカウント)]** セクションで **[有効にする]** を選択します。

**[保存]** を選択します。

GuardDuty でサービスの一部であるタスクをモニタリングする場合は、Runtime Monitoring を有効にした後に新しいサービスデプロイが必要です。Runtime Monitoring を有効にする前に特定の ECS サービスの最後のデプロイが開始された場合は、サービスを再起動するか、`forceNewDeployment` を使用してサービスを更新できます。

サービスを更新するステップについては、以下のリソースを参照してください。
+ 「*Amazon Elastic Container Service デベロッパーガイド*」の「[コンソールを使用した Amazon ECS サービスの更新](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/update-service-console-v2.html)」。
+ 「*Amazon Elastic Container Service API リファレンス*」の「[UpdateService](https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_UpdateService.html)」。
+ 「*AWS CLI コマンドリファレンス*」の「[update-service](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecs/update-service.html)」。

------
#### [ Manage for all Amazon ECS clusters but exclude some of the clusters (cluster level) ]

1. この Amazon ECS クラスターに、キーと値のペアを`GuardDutyManaged`-`false` というタグを追加します。

1. 信頼できるエンティティ以外は、タグを変更しないようにしてください。「*AWS Organizations ユーザーガイド*」の「[認められている原則による場合を除き、タグが変更されないようにする](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_scps_examples_tagging.html#example-require-restrict-tag-mods-to-admin)」に記載されているポリシーが、ここに適用できるように変更されました。

------
#### [ JSON ]

****  

   ```
   {
       "Version":"2012-10-17",		 	 	 
       "Statement": [
           {
               "Sid": "DenyModifyTagsIfResAuthzTagAndPrinTagDontMatch",
               "Effect": "Deny",
               "Action": [
                   "ecs:TagResource",
                   "ecs:UntagResource"
               ],
               "Resource": [
                   "*"
               ],
               "Condition": {
                   "StringNotEquals": {
                       "ecs:ResourceTag/GuardDutyManaged": "${aws:PrincipalTag/GuardDutyManaged}",
                       "aws:PrincipalArn": "arn:aws:iam::123456789012:role/org-admins/iam-admin"
                   },
                   "Null": {
                       "ecs:ResourceTag/GuardDutyManaged": false
                   }
               }
           },
           {
               "Sid": "DenyModifyResAuthzTagIfPrinTagDontMatch",
               "Effect": "Deny",
               "Action": [
                   "ecs:TagResource",
                   "ecs:UntagResource"
               ],
               "Resource": [
                   "*"
               ],
               "Condition": {
                   "StringNotEquals": {
                       "aws:RequestTag/GuardDutyManaged": "${aws:PrincipalTag/GuardDutyManaged}",
                       "aws:PrincipalArn": "arn:aws:iam::123456789012:role/org-admins/iam-admin"
                   },
                   "ForAnyValue:StringEquals": {
                       "aws:TagKeys": [
                           "GuardDutyManaged"
                       ]   
                   }   
               }
           },
           {       
               "Sid": "DenyModifyTagsIfPrinTagNotExists",
               "Effect": "Deny", 
               "Action": [
                   "ecs:TagResource",
                   "ecs:UntagResource"
               ],      
               "Resource": [
                   "*"     
               ],      
               "Condition": {
                   "StringNotEquals": {
                       "aws:PrincipalArn": "arn:aws:iam::123456789012:role/org-admins/iam-admin"
                   },      
                   "Null": {
                       "aws:PrincipalTag/GuardDutyManaged": true
                   }       
               }       
           }
       ]
   }
   ```

------

1. [https://console.aws.amazon.com/guardduty/](https://console.aws.amazon.com/guardduty/) で GuardDuty コンソールを開きます。

1. ナビゲーションペインで、**[Runtime Monitoring]** を選択します。

1. 
**注記**  
アカウントの自動エージェントの設定を有効にする前に、必ず Amazon ECS クラスターに除外タグを追加してください。追加しないと、GuardDuty サイドカーコンテナが起動される Amazon ECS タスクのすべてのコンテナに接続されます。

   **[設定]** タブの **[自動エージェント設定]** で **[有効化]** を選択します。

   除外されていない Amazon ECS クラスターの場合、GuardDuty がサイドカーコンテナ内のセキュリティエージェントのデプロイを管理します。

1. **[保存]** を選択します。

1. GuardDuty でサービスの一部であるタスクをモニタリングする場合は、Runtime Monitoring を有効にした後に新しいサービスデプロイが必要です。Runtime Monitoring を有効にする前に特定の ECS サービスの最後のデプロイが開始された場合は、サービスを再起動するか、`forceNewDeployment` を使用してサービスを更新できます。

   サービスを更新するステップについては、以下のリソースを参照してください。
   + 「*Amazon Elastic Container Service デベロッパーガイド*」の「[コンソールを使用した Amazon ECS サービスの更新](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/update-service-console-v2.html)」。
   + 「*Amazon Elastic Container Service API リファレンス*」の「[UpdateService](https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_UpdateService.html)」。
   + 「*AWS CLI コマンドリファレンス*」の「[update-service](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecs/update-service.html)」。

------
#### [ Manage for selective (inclusion only) Amazon ECS clusters (cluster level) ]

1. すべてのタスクを含む Amazon ECS クラスターにタグを追加します。キーと値のペアは `GuardDutyManaged`–`true` である必要があります。

1. 信頼できるエンティティ以外は、これらのタグを変更しないようにしてください。「*AWS Organizations ユーザーガイド*」の「[認められている原則による場合を除き、タグが変更されないようにする](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_scps_examples_tagging.html#example-require-restrict-tag-mods-to-admin)」に記載されているポリシーが、ここに適用できるように変更されました。

------
#### [ JSON ]

****  

   ```
   {
       "Version":"2012-10-17",		 	 	 
       "Statement": [
           {
               "Sid": "DenyModifyTagsIfResAuthzTagAndPrinTagDontMatch",
               "Effect": "Deny",
               "Action": [
                   "ecs:TagResource",
                   "ecs:UntagResource"
               ],
               "Resource": [
                   "*"
               ],
               "Condition": {
                   "StringNotEquals": {
                       "ecs:ResourceTag/GuardDutyManaged": "${aws:PrincipalTag/GuardDutyManaged}",
                       "aws:PrincipalArn": "arn:aws:iam::123456789012:role/org-admins/iam-admin"
                   },
                   "Null": {
                       "ecs:ResourceTag/GuardDutyManaged": false
                   }
               }
           },
           {
               "Sid": "DenyModifyResAuthzTagIfPrinTagDontMatch",
               "Effect": "Deny",
               "Action": [
                   "ecs:TagResource",
                   "ecs:UntagResource"
               ],
               "Resource": [
                   "*"
               ],
               "Condition": {
                   "StringNotEquals": {
                       "aws:RequestTag/GuardDutyManaged": "${aws:PrincipalTag/GuardDutyManaged}",
                       "aws:PrincipalArn": "arn:aws:iam::123456789012:role/org-admins/iam-admin"
                   },
                   "ForAnyValue:StringEquals": {
                       "aws:TagKeys": [
                           "GuardDutyManaged"
                       ]   
                   }   
               }
           },
           {       
               "Sid": "DenyModifyTagsIfPrinTagNotExists",
               "Effect": "Deny", 
               "Action": [
                   "ecs:TagResource",
                   "ecs:UntagResource"
               ],      
               "Resource": [
                   "*"     
               ],      
               "Condition": {
                   "StringNotEquals": {
                       "aws:PrincipalArn": "arn:aws:iam::123456789012:role/org-admins/iam-admin"
                   },      
                   "Null": {
                       "aws:PrincipalTag/GuardDutyManaged": true
                   }       
               }       
           }
       ]
   }
   ```

------
**注記**  
Amazon ECS クラスターに包含タグを使用する場合、自動エージェント設定によって GuardDuty エージェントを明示的に有効にする必要はありません。

1. GuardDuty でサービスの一部であるタスクをモニタリングする場合は、Runtime Monitoring を有効にした後に新しいサービスデプロイが必要です。Runtime Monitoring を有効にする前に特定の ECS サービスの最後のデプロイが開始された場合は、サービスを再起動するか、`forceNewDeployment` を使用してサービスを更新できます。

   サービスを更新するステップについては、以下のリソースを参照してください。
   + 「*Amazon Elastic Container Service デベロッパーガイド*」の「[コンソールを使用した Amazon ECS サービスの更新](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/update-service-console-v2.html)」。
   + 「*Amazon Elastic Container Service API リファレンス*」の「[UpdateService](https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_UpdateService.html)」。
   + 「*AWS CLI コマンドリファレンス*」の「[update-service](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecs/update-service.html)」。

------

### すべてのメンバーアカウントの自動有効化
<a name="ecs-auto-enable-all-member-accounts"></a>

------
#### [ Manage for all Amazon ECS clusters (account level) ]

以下の手順は、[Runtime Monitoring] セクションで **[すべてのアカウントで有効化]** を選択したことを前提としています。

1. [自動エージェント設定] セクションで **[すべてのアカウントについて有効にする]** を選択します。GuardDuty は、起動されるすべての Amazon ECS タスクについてセキュリティエージェントをデプロイして管理します。

1. **[保存]** を選択します。

1. GuardDuty でサービスの一部であるタスクをモニタリングする場合は、Runtime Monitoring を有効にした後に新しいサービスデプロイが必要です。Runtime Monitoring を有効にする前に特定の ECS サービスの最後のデプロイが開始された場合は、サービスを再起動するか、`forceNewDeployment` を使用してサービスを更新できます。

   サービスを更新するステップについては、以下のリソースを参照してください。
   + 「*Amazon Elastic Container Service デベロッパーガイド*」の「[コンソールを使用した Amazon ECS サービスの更新](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/update-service-console-v2.html)」。
   + 「*Amazon Elastic Container Service API リファレンス*」の「[UpdateService](https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_UpdateService.html)」。
   + 「*AWS CLI コマンドリファレンス*」の「[update-service](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecs/update-service.html)」。

------
#### [ Manage for all Amazon ECS clusters but exclude some of the clusters (cluster level) ]

1. この Amazon ECS クラスターに、キーと値のペアを`GuardDutyManaged`-`false` というタグを追加します。

1. 信頼できるエンティティ以外は、タグを変更しないようにしてください。「*AWS Organizations ユーザーガイド*」の「[認められている原則による場合を除き、タグが変更されないようにする](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_scps_examples_tagging.html#example-require-restrict-tag-mods-to-admin)」に記載されているポリシーが、ここに適用できるように変更されました。

------
#### [ JSON ]

****  

   ```
   {
       "Version":"2012-10-17",		 	 	 
       "Statement": [
           {
               "Sid": "DenyModifyTagsIfResAuthzTagAndPrinTagDontMatch",
               "Effect": "Deny",
               "Action": [
                   "ecs:TagResource",
                   "ecs:UntagResource"
               ],
               "Resource": [
                   "*"
               ],
               "Condition": {
                   "StringNotEquals": {
                       "ecs:ResourceTag/GuardDutyManaged": "${aws:PrincipalTag/GuardDutyManaged}",
                       "aws:PrincipalArn": "arn:aws:iam::123456789012:role/org-admins/iam-admin"
                   },
                   "Null": {
                       "ecs:ResourceTag/GuardDutyManaged": false
                   }
               }
           },
           {
               "Sid": "DenyModifyResAuthzTagIfPrinTagDontMatch",
               "Effect": "Deny",
               "Action": [
                   "ecs:TagResource",
                   "ecs:UntagResource"
               ],
               "Resource": [
                   "*"
               ],
               "Condition": {
                   "StringNotEquals": {
                       "aws:RequestTag/GuardDutyManaged": "${aws:PrincipalTag/GuardDutyManaged}",
                       "aws:PrincipalArn": "arn:aws:iam::123456789012:role/org-admins/iam-admin"
                   },
                   "ForAnyValue:StringEquals": {
                       "aws:TagKeys": [
                           "GuardDutyManaged"
                       ]   
                   }   
               }
           },
           {       
               "Sid": "DenyModifyTagsIfPrinTagNotExists",
               "Effect": "Deny", 
               "Action": [
                   "ecs:TagResource",
                   "ecs:UntagResource"
               ],      
               "Resource": [
                   "*"     
               ],      
               "Condition": {
                   "StringNotEquals": {
                       "aws:PrincipalArn": "arn:aws:iam::123456789012:role/org-admins/iam-admin"
                   },      
                   "Null": {
                       "aws:PrincipalTag/GuardDutyManaged": true
                   }       
               }       
           }
       ]
   }
   ```

------

1. [https://console.aws.amazon.com/guardduty/](https://console.aws.amazon.com/guardduty/) で GuardDuty コンソールを開きます。

1. ナビゲーションペインで、**[Runtime Monitoring]** を選択します。

1. 
**注記**  
アカウントの自動エージェントの設定を有効にする前に、必ず Amazon ECS クラスターに除外タグを追加してください。追加しないと、GuardDuty サイドカーコンテナが起動される Amazon ECS タスクのすべてのコンテナに接続されます。

   **[設定]** タブで、**[編集]** を選択します。

1. **[自動エージェント設定]** セクションで **[すべてのアカウントについて有効にする]** を選択します。

   除外されていない Amazon ECS クラスターの場合、GuardDuty がサイドカーコンテナ内のセキュリティエージェントのデプロイを管理します。

1. **[保存]** を選択します。

1. GuardDuty でサービスの一部であるタスクをモニタリングする場合は、Runtime Monitoring を有効にした後に新しいサービスデプロイが必要です。Runtime Monitoring を有効にする前に特定の ECS サービスの最後のデプロイが開始された場合は、サービスを再起動するか、`forceNewDeployment` を使用してサービスを更新できます。

   サービスを更新するステップについては、以下のリソースを参照してください。
   + 「*Amazon Elastic Container Service デベロッパーガイド*」の「[コンソールを使用した Amazon ECS サービスの更新](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/update-service-console-v2.html)」。
   + 「*Amazon Elastic Container Service API リファレンス*」の「[UpdateService](https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_UpdateService.html)」。
   + 「*AWS CLI コマンドリファレンス*」の「[update-service](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecs/update-service.html)」。

------
#### [ Manage for selective (inclusion-only) Amazon ECS clusters (cluster level) ]

Runtime Monitoring をどのように有効にするかにかかわらず、以下の手順は組織内のすべてのメンバーアカウントで選択する Amazon ECS Fargate タスクを監視するのに役立ちます。

1. [自動エージェント設定] セクションの設定はどれも有効にしないでください。Runtime Monitoring の設定は、前の手順で選択したものと同じにします。

1. **[保存]** を選択します。

1. 信頼できるエンティティ以外は、これらのタグを変更しないようにしてください。「*AWS Organizations ユーザーガイド*」の「[認められている原則による場合を除き、タグが変更されないようにする](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_scps_examples_tagging.html#example-require-restrict-tag-mods-to-admin)」に記載されているポリシーが、ここに適用できるように変更されました。

------
#### [ JSON ]

****  

   ```
   {
       "Version":"2012-10-17",		 	 	 
       "Statement": [
           {
               "Sid": "DenyModifyTagsIfResAuthzTagAndPrinTagDontMatch",
               "Effect": "Deny",
               "Action": [
                   "ecs:TagResource",
                   "ecs:UntagResource"
               ],
               "Resource": [
                   "*"
               ],
               "Condition": {
                   "StringNotEquals": {
                       "ecs:ResourceTag/GuardDutyManaged": "${aws:PrincipalTag/GuardDutyManaged}",
                       "aws:PrincipalArn": "arn:aws:iam::123456789012:role/org-admins/iam-admin"
                   },
                   "Null": {
                       "ecs:ResourceTag/GuardDutyManaged": false
                   }
               }
           },
           {
               "Sid": "DenyModifyResAuthzTagIfPrinTagDontMatch",
               "Effect": "Deny",
               "Action": [
                   "ecs:TagResource",
                   "ecs:UntagResource"
               ],
               "Resource": [
                   "*"
               ],
               "Condition": {
                   "StringNotEquals": {
                       "aws:RequestTag/GuardDutyManaged": "${aws:PrincipalTag/GuardDutyManaged}",
                       "aws:PrincipalArn": "arn:aws:iam::123456789012:role/org-admins/iam-admin"
                   },
                   "ForAnyValue:StringEquals": {
                       "aws:TagKeys": [
                           "GuardDutyManaged"
                       ]   
                   }   
               }
           },
           {       
               "Sid": "DenyModifyTagsIfPrinTagNotExists",
               "Effect": "Deny", 
               "Action": [
                   "ecs:TagResource",
                   "ecs:UntagResource"
               ],      
               "Resource": [
                   "*"     
               ],      
               "Condition": {
                   "StringNotEquals": {
                       "aws:PrincipalArn": "arn:aws:iam::123456789012:role/org-admins/iam-admin"
                   },      
                   "Null": {
                       "aws:PrincipalTag/GuardDutyManaged": true
                   }       
               }       
           }
       ]
   }
   ```

------
**注記**  
Amazon ECS クラスターにインクルージョンタグを使用する場合、**[GuardDuty エージェントの自動管理]** を明示的に有効にする必要はありません。

1. GuardDuty でサービスの一部であるタスクをモニタリングする場合は、Runtime Monitoring を有効にした後に新しいサービスデプロイが必要です。Runtime Monitoring を有効にする前に特定の ECS サービスの最後のデプロイが開始された場合は、サービスを再起動するか、`forceNewDeployment` を使用してサービスを更新できます。

   サービスを更新するステップについては、以下のリソースを参照してください。
   + 「*Amazon Elastic Container Service デベロッパーガイド*」の「[コンソールを使用した Amazon ECS サービスの更新](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/update-service-console-v2.html)」。
   + 「*Amazon Elastic Container Service API リファレンス*」の「[UpdateService](https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_UpdateService.html)」。
   + 「*AWS CLI コマンドリファレンス*」の「[update-service](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecs/update-service.html)」。

------

### 既存のアクティブなメンバーアカウントでエージェントの自動設定を有効にする
<a name="ecs-enable-existing-active-member-accounts"></a>

------
#### [ Manage for all Amazon ECS clusters (account level) ]

1. [Runtime Monitoring] ページの **[設定]** タブで、自動エージェント 設定の現在のステータスを表示できます。

1. [自動エージェント設定] ペイン内の **[アクティブメンバーアカウント]** セクションで、**[アクション]** を選択します。

1. **[アクション]** から、**[すべての既存のアクティブなメンバーアカウントについて有効にする]** を選択します。

1. **[確認]** を選択します。

1. GuardDuty でサービスの一部であるタスクをモニタリングする場合は、Runtime Monitoring を有効にした後に新しいサービスデプロイが必要です。Runtime Monitoring を有効にする前に特定の ECS サービスの最後のデプロイが開始された場合は、サービスを再起動するか、`forceNewDeployment` を使用してサービスを更新できます。

   サービスを更新するステップについては、以下のリソースを参照してください。
   + 「*Amazon Elastic Container Service デベロッパーガイド*」の「[コンソールを使用した Amazon ECS サービスの更新](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/update-service-console-v2.html)」。
   + 「*Amazon Elastic Container Service API リファレンス*」の「[UpdateService](https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_UpdateService.html)」。
   + 「*AWS CLI コマンドリファレンス*」の「[update-service](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecs/update-service.html)」。

------
#### [ Manage for all Amazon ECS clusters but exclude some of the clusters (cluster level) ]

1. この Amazon ECS クラスターに、キーと値のペアを`GuardDutyManaged`-`false` というタグを追加します。

1. 信頼できるエンティティ以外は、タグを変更しないようにしてください。「*AWS Organizations ユーザーガイド*」の「[認められている原則による場合を除き、タグが変更されないようにする](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_scps_examples_tagging.html#example-require-restrict-tag-mods-to-admin)」に記載されているポリシーが、ここに適用できるように変更されました。

------
#### [ JSON ]

****  

   ```
   {
       "Version":"2012-10-17",		 	 	 
       "Statement": [
           {
               "Sid": "DenyModifyTagsIfResAuthzTagAndPrinTagDontMatch",
               "Effect": "Deny",
               "Action": [
                   "ecs:TagResource",
                   "ecs:UntagResource"
               ],
               "Resource": [
                   "*"
               ],
               "Condition": {
                   "StringNotEquals": {
                       "ecs:ResourceTag/GuardDutyManaged": "${aws:PrincipalTag/GuardDutyManaged}",
                       "aws:PrincipalArn": "arn:aws:iam::123456789012:role/org-admins/iam-admin"
                   },
                   "Null": {
                       "ecs:ResourceTag/GuardDutyManaged": false
                   }
               }
           },
           {
               "Sid": "DenyModifyResAuthzTagIfPrinTagDontMatch",
               "Effect": "Deny",
               "Action": [
                   "ecs:TagResource",
                   "ecs:UntagResource"
               ],
               "Resource": [
                   "*"
               ],
               "Condition": {
                   "StringNotEquals": {
                       "aws:RequestTag/GuardDutyManaged": "${aws:PrincipalTag/GuardDutyManaged}",
                       "aws:PrincipalArn": "arn:aws:iam::123456789012:role/org-admins/iam-admin"
                   },
                   "ForAnyValue:StringEquals": {
                       "aws:TagKeys": [
                           "GuardDutyManaged"
                       ]   
                   }   
               }
           },
           {       
               "Sid": "DenyModifyTagsIfPrinTagNotExists",
               "Effect": "Deny", 
               "Action": [
                   "ecs:TagResource",
                   "ecs:UntagResource"
               ],      
               "Resource": [
                   "*"     
               ],      
               "Condition": {
                   "StringNotEquals": {
                       "aws:PrincipalArn": "arn:aws:iam::123456789012:role/org-admins/iam-admin"
                   },      
                   "Null": {
                       "aws:PrincipalTag/GuardDutyManaged": true
                   }       
               }       
           }
       ]
   }
   ```

------

1. [https://console.aws.amazon.com/guardduty/](https://console.aws.amazon.com/guardduty/) で GuardDuty コンソールを開きます。

1. ナビゲーションペインで、**[Runtime Monitoring]** を選択します。

1. 
**注記**  
アカウントの自動エージェントの設定を有効にする前に、必ず Amazon ECS クラスターに除外タグを追加してください。追加しないと、GuardDuty サイドカーコンテナが起動される Amazon ECS タスクのすべてのコンテナに接続されます。

   [自動エージェント設定] セクションの **[設定]** タブから **[アクティブなメンバーアカウント]** で **[アクション]** を選択します。

1. **[アクション]** から、**[すべてのアクティブなメンバーアカウントについて有効にする]** を選択します。

   除外されていない Amazon ECS クラスターの場合、GuardDuty がサイドカーコンテナ内のセキュリティエージェントのデプロイを管理します。

1. **[確認]** を選択します。

1. GuardDuty でサービスの一部であるタスクをモニタリングする場合は、Runtime Monitoring を有効にした後に新しいサービスデプロイが必要です。Runtime Monitoring を有効にする前に特定の ECS サービスの最後のデプロイが開始された場合は、サービスを再起動するか、`forceNewDeployment` を使用してサービスを更新できます。

   サービスを更新するステップについては、以下のリソースを参照してください。
   + 「*Amazon Elastic Container Service デベロッパーガイド*」の「[コンソールを使用した Amazon ECS サービスの更新](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/update-service-console-v2.html)」。
   + 「*Amazon Elastic Container Service API リファレンス*」の「[UpdateService](https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_UpdateService.html)」。
   + 「*AWS CLI コマンドリファレンス*」の「[update-service](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecs/update-service.html)」。

------
#### [ Manage for selective (inclusion only) Amazon ECS clusters (cluster level) ]

1. すべてのタスクを含む Amazon ECS クラスターにタグを追加します。キーと値のペアは `GuardDutyManaged`–`true` である必要があります。

1. 信頼できるエンティティ以外は、これらのタグを変更しないようにしてください。「*AWS Organizations ユーザーガイド*」の「[認められている原則による場合を除き、タグが変更されないようにする](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_scps_examples_tagging.html#example-require-restrict-tag-mods-to-admin)」に記載されているポリシーが、ここに適用できるように変更されました。

------
#### [ JSON ]

****  

   ```
   {
       "Version":"2012-10-17",		 	 	 
       "Statement": [
           {
               "Sid": "DenyModifyTagsIfResAuthzTagAndPrinTagDontMatch",
               "Effect": "Deny",
               "Action": [
                   "ecs:TagResource",
                   "ecs:UntagResource"
               ],
               "Resource": [
                   "*"
               ],
               "Condition": {
                   "StringNotEquals": {
                       "ecs:ResourceTag/GuardDutyManaged": "${aws:PrincipalTag/GuardDutyManaged}",
                       "aws:PrincipalArn": "arn:aws:iam::123456789012:role/org-admins/iam-admin"
                   },
                   "Null": {
                       "ecs:ResourceTag/GuardDutyManaged": false
                   }
               }
           },
           {
               "Sid": "DenyModifyResAuthzTagIfPrinTagDontMatch",
               "Effect": "Deny",
               "Action": [
                   "ecs:TagResource",
                   "ecs:UntagResource"
               ],
               "Resource": [
                   "*"
               ],
               "Condition": {
                   "StringNotEquals": {
                       "aws:RequestTag/GuardDutyManaged": "${aws:PrincipalTag/GuardDutyManaged}",
                       "aws:PrincipalArn": "arn:aws:iam::123456789012:role/org-admins/iam-admin"
                   },
                   "ForAnyValue:StringEquals": {
                       "aws:TagKeys": [
                           "GuardDutyManaged"
                       ]   
                   }   
               }
           },
           {       
               "Sid": "DenyModifyTagsIfPrinTagNotExists",
               "Effect": "Deny", 
               "Action": [
                   "ecs:TagResource",
                   "ecs:UntagResource"
               ],      
               "Resource": [
                   "*"     
               ],      
               "Condition": {
                   "StringNotEquals": {
                       "aws:PrincipalArn": "arn:aws:iam::123456789012:role/org-admins/iam-admin"
                   },      
                   "Null": {
                       "aws:PrincipalTag/GuardDutyManaged": true
                   }       
               }       
           }
       ]
   }
   ```

------
**注記**  
Amazon ECS クラスターに包含タグを使用する場合、**[自動エージェント設定]** を明示的に有効にする必要はありません。

1. GuardDuty でサービスの一部であるタスクをモニタリングする場合は、Runtime Monitoring を有効にした後に新しいサービスデプロイが必要です。Runtime Monitoring を有効にする前に特定の ECS サービスの最後のデプロイが開始された場合は、サービスを再起動するか、`forceNewDeployment` を使用してサービスを更新できます。

   サービスを更新するステップについては、以下のリソースを参照してください。
   + 「*Amazon Elastic Container Service デベロッパーガイド*」の「[コンソールを使用した Amazon ECS サービスの更新](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/update-service-console-v2.html)」。
   + 「*Amazon Elastic Container Service API リファレンス*」の「[UpdateService](https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_UpdateService.html)」。
   + 「*AWS CLI コマンドリファレンス*」の「[update-service](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecs/update-service.html)」。

------

### 新規メンバー用の自動エージェント設定を自動有効化
<a name="ecs-auto-enable-new-members-only"></a>

------
#### [ Manage for all Amazon ECS clusters (account level) ]

1. [Runtime Monitoring] ページで、**[編集]** を選択して既存の設定を更新します。

1. [自動エージェント設定] セクションで **[すべてのアカウントについて有効にする]** を選択します。

1. **[保存]** を選択します。

1. GuardDuty でサービスの一部であるタスクをモニタリングする場合は、Runtime Monitoring を有効にした後に新しいサービスデプロイが必要です。Runtime Monitoring を有効にする前に特定の ECS サービスの最後のデプロイが開始された場合は、サービスを再起動するか、`forceNewDeployment` を使用してサービスを更新できます。

   サービスを更新するステップについては、以下のリソースを参照してください。
   + 「*Amazon Elastic Container Service デベロッパーガイド*」の「[コンソールを使用した Amazon ECS サービスの更新](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/update-service-console-v2.html)」。
   + 「*Amazon Elastic Container Service API リファレンス*」の「[UpdateService](https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_UpdateService.html)」。
   + 「*AWS CLI コマンドリファレンス*」の「[update-service](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecs/update-service.html)」。

------
#### [ Manage for all Amazon ECS clusters but exclude some of the clusters (cluster level) ]

1. この Amazon ECS クラスターに、キーと値のペアを`GuardDutyManaged`-`false` というタグを追加します。

1. 信頼できるエンティティ以外は、タグを変更しないようにしてください。「*AWS Organizations ユーザーガイド*」の「[認められている原則による場合を除き、タグが変更されないようにする](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_scps_examples_tagging.html#example-require-restrict-tag-mods-to-admin)」に記載されているポリシーが、ここに適用できるように変更されました。

------
#### [ JSON ]

****  

   ```
   {
       "Version":"2012-10-17",		 	 	 
       "Statement": [
           {
               "Sid": "DenyModifyTagsIfResAuthzTagAndPrinTagDontMatch",
               "Effect": "Deny",
               "Action": [
                   "ecs:TagResource",
                   "ecs:UntagResource"
               ],
               "Resource": [
                   "*"
               ],
               "Condition": {
                   "StringNotEquals": {
                       "ecs:ResourceTag/GuardDutyManaged": "${aws:PrincipalTag/GuardDutyManaged}",
                       "aws:PrincipalArn": "arn:aws:iam::123456789012:role/org-admins/iam-admin"
                   },
                   "Null": {
                       "ecs:ResourceTag/GuardDutyManaged": false
                   }
               }
           },
           {
               "Sid": "DenyModifyResAuthzTagIfPrinTagDontMatch",
               "Effect": "Deny",
               "Action": [
                   "ecs:TagResource",
                   "ecs:UntagResource"
               ],
               "Resource": [
                   "*"
               ],
               "Condition": {
                   "StringNotEquals": {
                       "aws:RequestTag/GuardDutyManaged": "${aws:PrincipalTag/GuardDutyManaged}",
                       "aws:PrincipalArn": "arn:aws:iam::123456789012:role/org-admins/iam-admin"
                   },
                   "ForAnyValue:StringEquals": {
                       "aws:TagKeys": [
                           "GuardDutyManaged"
                       ]   
                   }   
               }
           },
           {       
               "Sid": "DenyModifyTagsIfPrinTagNotExists",
               "Effect": "Deny", 
               "Action": [
                   "ecs:TagResource",
                   "ecs:UntagResource"
               ],      
               "Resource": [
                   "*"     
               ],      
               "Condition": {
                   "StringNotEquals": {
                       "aws:PrincipalArn": "arn:aws:iam::123456789012:role/org-admins/iam-admin"
                   },      
                   "Null": {
                       "aws:PrincipalTag/GuardDutyManaged": true
                   }       
               }       
           }
       ]
   }
   ```

------

1. [https://console.aws.amazon.com/guardduty/](https://console.aws.amazon.com/guardduty/) で GuardDuty コンソールを開きます。

1. ナビゲーションペインで、**[Runtime Monitoring]** を選択します。

1. 
**注記**  
アカウントの自動エージェントの設定を有効にする前に、必ず Amazon ECS クラスターに除外タグを追加してください。追加しないと、GuardDuty サイドカーコンテナが起動される Amazon ECS タスクのすべてのコンテナに接続されます。

   **[設定]** タブの **[自動エージェント設定]** セクションで、**[新しいメンバーアカウントについて自動的に有効にする]** を選択します。

   除外されていない Amazon ECS クラスターの場合、GuardDuty がサイドカーコンテナ内のセキュリティエージェントのデプロイを管理します。

1. **[保存]** を選択します。

1. GuardDuty でサービスの一部であるタスクをモニタリングする場合は、Runtime Monitoring を有効にした後に新しいサービスデプロイが必要です。Runtime Monitoring を有効にする前に特定の ECS サービスの最後のデプロイが開始された場合は、サービスを再起動するか、`forceNewDeployment` を使用してサービスを更新できます。

   サービスを更新するステップについては、以下のリソースを参照してください。
   + 「*Amazon Elastic Container Service デベロッパーガイド*」の「[コンソールを使用した Amazon ECS サービスの更新](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/update-service-console-v2.html)」。
   + 「*Amazon Elastic Container Service API リファレンス*」の「[UpdateService](https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_UpdateService.html)」。
   + 「*AWS CLI コマンドリファレンス*」の「[update-service](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecs/update-service.html)」。

------
#### [ Manage for selective (inclusion only) Amazon ECS clusters (cluster level) ]

1. すべてのタスクを含む Amazon ECS クラスターにタグを追加します。キーと値のペアは `GuardDutyManaged`–`true` である必要があります。

1. 信頼できるエンティティ以外は、これらのタグを変更しないようにしてください。「*AWS Organizations ユーザーガイド*」の「[認められている原則による場合を除き、タグが変更されないようにする](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_scps_examples_tagging.html#example-require-restrict-tag-mods-to-admin)」に記載されているポリシーが、ここに適用できるように変更されました。

------
#### [ JSON ]

****  

   ```
   {
       "Version":"2012-10-17",		 	 	 
       "Statement": [
           {
               "Sid": "DenyModifyTagsIfResAuthzTagAndPrinTagDontMatch",
               "Effect": "Deny",
               "Action": [
                   "ecs:TagResource",
                   "ecs:UntagResource"
               ],
               "Resource": [
                   "*"
               ],
               "Condition": {
                   "StringNotEquals": {
                       "ecs:ResourceTag/GuardDutyManaged": "${aws:PrincipalTag/GuardDutyManaged}",
                       "aws:PrincipalArn": "arn:aws:iam::123456789012:role/org-admins/iam-admin"
                   },
                   "Null": {
                       "ecs:ResourceTag/GuardDutyManaged": false
                   }
               }
           },
           {
               "Sid": "DenyModifyResAuthzTagIfPrinTagDontMatch",
               "Effect": "Deny",
               "Action": [
                   "ecs:TagResource",
                   "ecs:UntagResource"
               ],
               "Resource": [
                   "*"
               ],
               "Condition": {
                   "StringNotEquals": {
                       "aws:RequestTag/GuardDutyManaged": "${aws:PrincipalTag/GuardDutyManaged}",
                       "aws:PrincipalArn": "arn:aws:iam::123456789012:role/org-admins/iam-admin"
                   },
                   "ForAnyValue:StringEquals": {
                       "aws:TagKeys": [
                           "GuardDutyManaged"
                       ]   
                   }   
               }
           },
           {       
               "Sid": "DenyModifyTagsIfPrinTagNotExists",
               "Effect": "Deny", 
               "Action": [
                   "ecs:TagResource",
                   "ecs:UntagResource"
               ],      
               "Resource": [
                   "*"     
               ],      
               "Condition": {
                   "StringNotEquals": {
                       "aws:PrincipalArn": "arn:aws:iam::123456789012:role/org-admins/iam-admin"
                   },      
                   "Null": {
                       "aws:PrincipalTag/GuardDutyManaged": true
                   }       
               }       
           }
       ]
   }
   ```

------
**注記**  
Amazon ECS クラスターに包含タグを使用する場合、**[自動エージェント設定]** を明示的に有効にする必要はありません。

1. GuardDuty でサービスの一部であるタスクをモニタリングする場合は、Runtime Monitoring を有効にした後に新しいサービスデプロイが必要です。Runtime Monitoring を有効にする前に特定の ECS サービスの最後のデプロイが開始された場合は、サービスを再起動するか、`forceNewDeployment` を使用してサービスを更新できます。

   サービスを更新するステップについては、以下のリソースを参照してください。
   + 「*Amazon Elastic Container Service デベロッパーガイド*」の「[コンソールを使用した Amazon ECS サービスの更新](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/update-service-console-v2.html)」。
   + 「*Amazon Elastic Container Service API リファレンス*」の「[UpdateService](https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_UpdateService.html)」。
   + 「*AWS CLI コマンドリファレンス*」の「[update-service](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecs/update-service.html)」。

------

### アクティブなメンバーアカウントの自動エージェント設定を選択的に有効にする
<a name="ecs-enable-gdu-agent-individual-active-members"></a>

------
#### [ Manage for all Amazon ECS (account level) ]

1. [アカウント] ページで、Runtime Monitoring 自動エージェント設定 (ECS-Fargate) を有効にするアカウントを選択します。複数のアカウントを選択できます。この手順で選択したアカウントで Runtime Monitoring が既に有効になっていることを確認してください。

1. **[保護プランの編集]** から、適切なオプションを選択して **[Runtime Monitoring 自動エージェントを設定 (ECS-Fargate)]** を有効にします。

1. **[確認]** を選択します。

1. GuardDuty でサービスの一部であるタスクをモニタリングする場合は、Runtime Monitoring を有効にした後に新しいサービスデプロイが必要です。Runtime Monitoring を有効にする前に特定の ECS サービスの最後のデプロイが開始された場合は、サービスを再起動するか、`forceNewDeployment` を使用してサービスを更新できます。

   サービスを更新するステップについては、以下のリソースを参照してください。
   + 「*Amazon Elastic Container Service デベロッパーガイド*」の「[コンソールを使用した Amazon ECS サービスの更新](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/update-service-console-v2.html)」。
   + 「*Amazon Elastic Container Service API リファレンス*」の「[UpdateService](https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_UpdateService.html)」。
   + 「*AWS CLI コマンドリファレンス*」の「[update-service](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecs/update-service.html)」。

------
#### [ Manage for all Amazon ECS clusters but exclude some of the clusters (cluster level) ]

1. この Amazon ECS クラスターに、キーと値のペアを`GuardDutyManaged`-`false` というタグを追加します。

1. 信頼できるエンティティ以外は、タグを変更しないようにしてください。「*AWS Organizations ユーザーガイド*」の「[認められている原則による場合を除き、タグが変更されないようにする](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_scps_examples_tagging.html#example-require-restrict-tag-mods-to-admin)」に記載されているポリシーが、ここに適用できるように変更されました。

------
#### [ JSON ]

****  

   ```
   {
       "Version":"2012-10-17",		 	 	 
       "Statement": [
           {
               "Sid": "DenyModifyTagsIfResAuthzTagAndPrinTagDontMatch",
               "Effect": "Deny",
               "Action": [
                   "ecs:TagResource",
                   "ecs:UntagResource"
               ],
               "Resource": [
                   "*"
               ],
               "Condition": {
                   "StringNotEquals": {
                       "ecs:ResourceTag/GuardDutyManaged": "${aws:PrincipalTag/GuardDutyManaged}",
                       "aws:PrincipalArn": "arn:aws:iam::123456789012:role/org-admins/iam-admin"
                   },
                   "Null": {
                       "ecs:ResourceTag/GuardDutyManaged": false
                   }
               }
           },
           {
               "Sid": "DenyModifyResAuthzTagIfPrinTagDontMatch",
               "Effect": "Deny",
               "Action": [
                   "ecs:TagResource",
                   "ecs:UntagResource"
               ],
               "Resource": [
                   "*"
               ],
               "Condition": {
                   "StringNotEquals": {
                       "aws:RequestTag/GuardDutyManaged": "${aws:PrincipalTag/GuardDutyManaged}",
                       "aws:PrincipalArn": "arn:aws:iam::123456789012:role/org-admins/iam-admin"
                   },
                   "ForAnyValue:StringEquals": {
                       "aws:TagKeys": [
                           "GuardDutyManaged"
                       ]   
                   }   
               }
           },
           {       
               "Sid": "DenyModifyTagsIfPrinTagNotExists",
               "Effect": "Deny", 
               "Action": [
                   "ecs:TagResource",
                   "ecs:UntagResource"
               ],      
               "Resource": [
                   "*"     
               ],      
               "Condition": {
                   "StringNotEquals": {
                       "aws:PrincipalArn": "arn:aws:iam::123456789012:role/org-admins/iam-admin"
                   },      
                   "Null": {
                       "aws:PrincipalTag/GuardDutyManaged": true
                   }       
               }       
           }
       ]
   }
   ```

------

1. [https://console.aws.amazon.com/guardduty/](https://console.aws.amazon.com/guardduty/) で GuardDuty コンソールを開きます。

1. ナビゲーションペインで、**[Runtime Monitoring]** を選択します。

1. 
**注記**  
アカウントの GuardDuty エージェントの自動管理を有効にする前に、必ず Amazon ECS クラスターに除外タグを追加してください。追加しないと、GuardDuty サイドカーコンテナが起動される Amazon ECS タスク内のコンテナすべてにアタッチされます。

   [アカウント] ページで、Runtime Monitoring 自動エージェント設定 (ECS-Fargate) を有効にするアカウントを選択します。複数のアカウントを選択できます。この手順で選択したアカウントで Runtime Monitoring が既に有効になっていることを確認してください。

   除外されていない Amazon ECS クラスターの場合、GuardDuty がサイドカーコンテナ内のセキュリティエージェントのデプロイを管理します。

1. **[保護プランの編集]** から、適切なオプションを選択して **[Runtime Monitoring 自動エージェントを設定 (ECS-Fargate)]** を有効にします。

1. **[保存]** を選択します。

1. GuardDuty でサービスの一部であるタスクをモニタリングする場合は、Runtime Monitoring を有効にした後に新しいサービスデプロイが必要です。Runtime Monitoring を有効にする前に特定の ECS サービスの最後のデプロイが開始された場合は、サービスを再起動するか、`forceNewDeployment` を使用してサービスを更新できます。

   サービスを更新するステップについては、以下のリソースを参照してください。
   + 「*Amazon Elastic Container Service デベロッパーガイド*」の「[コンソールを使用した Amazon ECS サービスの更新](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/update-service-console-v2.html)」。
   + 「*Amazon Elastic Container Service API リファレンス*」の「[UpdateService](https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_UpdateService.html)」。
   + 「*AWS CLI コマンドリファレンス*」の「[update-service](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecs/update-service.html)」。

------
#### [ Manage for selective (inclusion only) Amazon ECS clusters (cluster level) ]

1. 監視する Amazon ECS クラスターを含む選択したアカウントで、**[自動エージェント設定]** (または **[Runtime Monitoring 自動エージェント設定 (ECS-Fargate)**]) を有効にしていないことを確認してください。

1. すべてのタスクを含む Amazon ECS クラスターにタグを追加します。キーと値のペアは `GuardDutyManaged`–`true` である必要があります。

1. 信頼できるエンティティ以外は、これらのタグを変更しないようにしてください。「*AWS Organizations ユーザーガイド*」の「[認められている原則による場合を除き、タグが変更されないようにする](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_scps_examples_tagging.html#example-require-restrict-tag-mods-to-admin)」に記載されているポリシーが、ここに適用できるように変更されました。

------
#### [ JSON ]

****  

   ```
   {
       "Version":"2012-10-17",		 	 	 
       "Statement": [
           {
               "Sid": "DenyModifyTagsIfResAuthzTagAndPrinTagDontMatch",
               "Effect": "Deny",
               "Action": [
                   "ecs:TagResource",
                   "ecs:UntagResource"
               ],
               "Resource": [
                   "*"
               ],
               "Condition": {
                   "StringNotEquals": {
                       "ecs:ResourceTag/GuardDutyManaged": "${aws:PrincipalTag/GuardDutyManaged}",
                       "aws:PrincipalArn": "arn:aws:iam::123456789012:role/org-admins/iam-admin"
                   },
                   "Null": {
                       "ecs:ResourceTag/GuardDutyManaged": false
                   }
               }
           },
           {
               "Sid": "DenyModifyResAuthzTagIfPrinTagDontMatch",
               "Effect": "Deny",
               "Action": [
                   "ecs:TagResource",
                   "ecs:UntagResource"
               ],
               "Resource": [
                   "*"
               ],
               "Condition": {
                   "StringNotEquals": {
                       "aws:RequestTag/GuardDutyManaged": "${aws:PrincipalTag/GuardDutyManaged}",
                       "aws:PrincipalArn": "arn:aws:iam::123456789012:role/org-admins/iam-admin"
                   },
                   "ForAnyValue:StringEquals": {
                       "aws:TagKeys": [
                           "GuardDutyManaged"
                       ]   
                   }   
               }
           },
           {       
               "Sid": "DenyModifyTagsIfPrinTagNotExists",
               "Effect": "Deny", 
               "Action": [
                   "ecs:TagResource",
                   "ecs:UntagResource"
               ],      
               "Resource": [
                   "*"     
               ],      
               "Condition": {
                   "StringNotEquals": {
                       "aws:PrincipalArn": "arn:aws:iam::123456789012:role/org-admins/iam-admin"
                   },      
                   "Null": {
                       "aws:PrincipalTag/GuardDutyManaged": true
                   }       
               }       
           }
       ]
   }
   ```

------
**注記**  
Amazon ECS クラスターに包含タグを使用する場合、**[自動エージェント設定]** を明示的に有効にする必要はありません。

1. GuardDuty でサービスの一部であるタスクをモニタリングする場合は、Runtime Monitoring を有効にした後に新しいサービスデプロイが必要です。Runtime Monitoring を有効にする前に特定の ECS サービスの最後のデプロイが開始された場合は、サービスを再起動するか、`forceNewDeployment` を使用してサービスを更新できます。

   サービスを更新するステップについては、以下のリソースを参照してください。
   + 「*Amazon Elastic Container Service デベロッパーガイド*」の「[コンソールを使用した Amazon ECS サービスの更新](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/update-service-console-v2.html)」。
   + 「*Amazon Elastic Container Service API リファレンス*」の「[UpdateService](https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_UpdateService.html)」。
   + 「*AWS CLI コマンドリファレンス*」の「[update-service](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecs/update-service.html)」。

------

## スタンドアロンアカウントの GuardDuty エージェント の設定
<a name="ecs-fargate-manage-agent-standalone-account"></a>

1. にサインイン AWS マネジメントコンソール し、[https://console.aws.amazon.com/guardduty/](https://console.aws.amazon.com/guardduty/) で GuardDuty コンソールを開きます。

1. ナビゲーションペインで、**[Runtime Monitoring]** を選択します。

1. **[設定]** タブ:

   1. 

**すべての Amazon ECS クラスターの自動エージェント設定を管理するには (アカウントレベル)**

      **[AWS Fargate (ECS のみ)]** の **[自動エージェント設定]** セクションで **[有効にする]** を選択します。新しい Fargate Amazon ECS タスクが起動すると、GuardDuty がセキュリティエージェントのデプロイを管理します。

      1. **[保存]** を選択します。

   1. 

**Amazon ECS クラスターの一部を除外して自動エージェント設定を管理するには (クラスターレベル)**

      1. すべてのタスクを除外する Amazon ECS クラスターにタグを追加します。キーと値のペアは `GuardDutyManaged`–`false` である必要があります。

      1. 信頼できるエンティティ以外は、これらのタグを変更しないようにしてください。「*AWS Organizations ユーザーガイド*」の「[認められている原則による場合を除き、タグが変更されないようにする](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_scps_examples_tagging.html#example-require-restrict-tag-mods-to-admin)」に記載されているポリシーが、ここに適用できるように変更されました。

------
#### [ JSON ]

****  

         ```
         {
             "Version":"2012-10-17",		 	 	 
             "Statement": [
                 {
                     "Sid": "DenyModifyTagsIfResAuthzTagAndPrinTagDontMatch",
                     "Effect": "Deny",
                     "Action": [
                         "ecs:TagResource",
                         "ecs:UntagResource"
                     ],
                     "Resource": [
                         "*"
                     ],
                     "Condition": {
                         "StringNotEquals": {
                             "ecs:ResourceTag/GuardDutyManaged": "${aws:PrincipalTag/GuardDutyManaged}",
                             "aws:PrincipalArn": "arn:aws:iam::123456789012:role/org-admins/iam-admin"
                         },
                         "Null": {
                             "ecs:ResourceTag/GuardDutyManaged": false
                         }
                     }
                 },
                 {
                     "Sid": "DenyModifyResAuthzTagIfPrinTagDontMatch",
                     "Effect": "Deny",
                     "Action": [
                         "ecs:TagResource",
                         "ecs:UntagResource"
                     ],
                     "Resource": [
                         "*"
                     ],
                     "Condition": {
                         "StringNotEquals": {
                             "aws:RequestTag/GuardDutyManaged": "${aws:PrincipalTag/GuardDutyManaged}",
                             "aws:PrincipalArn": "arn:aws:iam::123456789012:role/org-admins/iam-admin"
                         },
                         "ForAnyValue:StringEquals": {
                             "aws:TagKeys": [
                                 "GuardDutyManaged"
                             ]   
                         }   
                     }
                 },
                 {       
                     "Sid": "DenyModifyTagsIfPrinTagNotExists",
                     "Effect": "Deny", 
                     "Action": [
                         "ecs:TagResource",
                         "ecs:UntagResource"
                     ],      
                     "Resource": [
                         "*"     
                     ],      
                     "Condition": {
                         "StringNotEquals": {
                             "aws:PrincipalArn": "arn:aws:iam::123456789012:role/org-admins/iam-admin"
                         },      
                         "Null": {
                             "aws:PrincipalTag/GuardDutyManaged": true
                         }       
                     }       
                 }
             ]
         }
         ```

------

      1. **[設定]** タブの **[自動エージェント設定]** セクションで **[有効化]** を選択します。
**注記**  
アカウントの GuardDuty エージェントの自動管理を有効にする前に、必ず Amazon ECS クラスターに除外タグを追加してください。追加しないと、セキュリティエージェントが対応する Amazon ECS クラスター内で開始されるすべてのタスクにデプロイされます。

         除外されていない Amazon ECS クラスターの場合、GuardDuty がサイドカーコンテナ内のセキュリティエージェントのデプロイを管理します。

      1. **[保存]** を選択します。

   1. 

**Amazon ECS クラスターの一部を含めて自動エージェント設定を管理するには (クラスターレベル)**

      1. すべてのタスクを含む Amazon ECS クラスターにタグを追加します。キーと値のペアは `GuardDutyManaged`–`true` である必要があります。

      1. 信頼できるエンティティ以外は、これらのタグを変更しないようにしてください。「*AWS Organizations ユーザーガイド*」の「[認められている原則による場合を除き、タグが変更されないようにする](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_scps_examples_tagging.html#example-require-restrict-tag-mods-to-admin)」に記載されているポリシーが、ここに適用できるように変更されました。

------
#### [ JSON ]

****  

         ```
         {
             "Version":"2012-10-17",		 	 	 
             "Statement": [
                 {
                     "Sid": "DenyModifyTagsIfResAuthzTagAndPrinTagDontMatch",
                     "Effect": "Deny",
                     "Action": [
                         "ecs:TagResource",
                         "ecs:UntagResource"
                     ],
                     "Resource": [
                         "*"
                     ],
                     "Condition": {
                         "StringNotEquals": {
                             "ecs:ResourceTag/GuardDutyManaged": "${aws:PrincipalTag/GuardDutyManaged}",
                             "aws:PrincipalArn": "arn:aws:iam::123456789012:role/org-admins/iam-admin"
                         },
                         "Null": {
                             "ecs:ResourceTag/GuardDutyManaged": false
                         }
                     }
                 },
                 {
                     "Sid": "DenyModifyResAuthzTagIfPrinTagDontMatch",
                     "Effect": "Deny",
                     "Action": [
                         "ecs:TagResource",
                         "ecs:UntagResource"
                     ],
                     "Resource": [
                         "*"
                     ],
                     "Condition": {
                         "StringNotEquals": {
                             "aws:RequestTag/GuardDutyManaged": "${aws:PrincipalTag/GuardDutyManaged}",
                             "aws:PrincipalArn": "arn:aws:iam::123456789012:role/org-admins/iam-admin"
                         },
                         "ForAnyValue:StringEquals": {
                             "aws:TagKeys": [
                                 "GuardDutyManaged"
                             ]   
                         }   
                     }
                 },
                 {       
                     "Sid": "DenyModifyTagsIfPrinTagNotExists",
                     "Effect": "Deny", 
                     "Action": [
                         "ecs:TagResource",
                         "ecs:UntagResource"
                     ],      
                     "Resource": [
                         "*"     
                     ],      
                     "Condition": {
                         "StringNotEquals": {
                             "aws:PrincipalArn": "arn:aws:iam::123456789012:role/org-admins/iam-admin"
                         },      
                         "Null": {
                             "aws:PrincipalTag/GuardDutyManaged": true
                         }       
                     }       
                 }
             ]
         }
         ```

------

1. GuardDuty でサービスの一部であるタスクをモニタリングする場合は、Runtime Monitoring を有効にした後に新しいサービスデプロイが必要です。Runtime Monitoring を有効にする前に特定の ECS サービスの最後のデプロイが開始された場合は、サービスを再起動するか、`forceNewDeployment` を使用してサービスを更新できます。

   サービスを更新するステップについては、以下のリソースを参照してください。
   + 「*Amazon Elastic Container Service デベロッパーガイド*」の「[コンソールを使用した Amazon ECS サービスの更新](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/update-service-console-v2.html)」。
   + 「*Amazon Elastic Container Service API リファレンス*」の「[UpdateService](https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_UpdateService.html)」。
   + 「*AWS CLI コマンドリファレンス*」の「[update-service](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecs/update-service.html)」。