

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 从 EKS 运行时监控迁移到运行时监控


随着 GuardDuty 运行时监控的推出，威胁检测范围已扩展到 Amazon ECS 容器和 Amazon EC2 实例。EKS 运行时监控体验现已整合到运行时监控中。您可以为要监控运行时行为的每种资源类型（Amazon EC2 实例、Amazon ECS 集群和 Amazon EKS 集群）启用运行时监控并管理单独 GuardDuty 的安全代理。

GuardDuty 已将 EKS 运行时监控的控制台体验整合到运行时监控中。 GuardDuty 推荐[检查 EKS 运行时监控配置状态](checking-eks-runtime-monitoring-enable-status.md)和[从 EKS 运行时监控迁移到运行时监控](#migrating-from-eksrunmon-to-runtime-monitoring)。

在迁移到运行时监控时，务必要[禁用 EKS 运行时监控](disabling-eks-runtime-monitoring.md)。这一点十分重要，因为如果您以后选择禁用运行时监控，但未禁用 EKS 运行时监控，则将继续产生 EKS 运行时监控的使用成本。

**从 EKS 运行时监控迁移到运行时监控**

1.  GuardDuty 控制台支持 EKS 运行时监控作为运行时监控的一部分。

   您可以通过为组织和账户[检查 EKS 运行时监控配置状态](checking-eks-runtime-monitoring-enable-status.md)来开始使用运行时监控。

   在启用运行时监控之前，务必不要禁用 EKS 运行时监控。如果您禁用 EKS 运行时监控，Amazon EKS 附加组件管理也将被禁用。请按所列顺序继续完成以下步骤。

1. 确保满足所有[启用运行时监控的先决条件](runtime-monitoring-prerequisites.md)。

1. 要启用运行时监控，您可以为运行时监控复制与 EKS 运行时监控相同的组织配置设置。有关更多信息，请参阅 [启用运行时监控](runtime-monitoring-configuration.md)。
   + 如果您有独立账户，则需要启用运行时监控。

     如果您的 GuardDuty 安全代理已经部署，则会自动复制相应的设置，您无需再次配置设置。
   + 如果您的组织配置了自动启用设置，请确保为运行时监控复制相同的自动启用设置。
   + 如果您的组织单独为现有活跃成员帐户配置了设置，请确保启用运行时监控并为这些成员单独配置 GuardDuty 安全代理。

1. 确保运行时监控和 GuardDuty 安全代理设置正确后，使用 API 或[Amazon CLI 命令禁用 EKS 运行时监控](https://docs.amazonaws.cn/guardduty/latest/ug/disabling-eks-runtime-monitoring.html)。

1. （可选）如果要清理与 GuardDuty 安全代理关联的任何资源，请参阅[在运行时监控中禁用、卸载和清理资源](runtime-monitoring-agent-resource-clean-up.md)。

如果要在不启用运行时监控的情况下继续使用 EKS 运行时监控，请参阅 [EKS 运行时监控在 GuardDuty](eks-runtime-monitoring-guardduty.md)。根据具体应用场景，选择为独立账户或多个成员账户配置 EKS 运行时监控的步骤。

# 检查 EKS 运行时监控配置状态


使用以下 APIs 或 Amazon CLI 命令检查 EKS 运行时监控的现有配置状态。

**检查您账户中现有的 EKS 运行时监控配置状态**
+ 运行[GetDetector](https://docs.amazonaws.cn/guardduty/latest/APIReference/API_GetDetector.html)以检查您自己账户的配置状态。
+ 您也可以使用 Amazon CLI来运行以下命令：

  ```
  aws guardduty get-detector --detector-id 12abc34d567e8fa901bc2d34e56789f0 --region us-east-1
  ```

  请务必替换您 Amazon Web Services 账户 和当前地区的探测器 ID。要查找您的账户和当前区域的，请查看[https://console.aws.amazon.com/guardduty/](https://console.amazonaws.cn/guardduty/)控制台中的 **“设置**” 页面，或者运行 [https://docs.amazonaws.cn/guardduty/latest/APIReference/API_ListDetectors.html](https://docs.amazonaws.cn/guardduty/latest/APIReference/API_ListDetectors.html)API。`detectorId`

**检查您组织的现有 EKS 运行时监控配置状态（仅限作为委托 GuardDuty 管理员帐户）**
+ 运行[DescribeOrganizationConfiguration](https://docs.amazonaws.cn/guardduty/latest/APIReference/API_DescribeOrganizationConfiguration.html)以检查您的组织的配置状态。

  您也可以使用 Amazon CLI来运行以下命令：

  ```
  aws guardduty describe-organization-configuration --detector-id 12abc34d567e8fa901bc2d34e56789f0 --region us-east-1
  ```

  请务必将探测器 ID 替换为您委派的 GuardDuty 管理员账户的探测器 ID，将区域替换为您当前的区域。要查找您的账户和当前区域的，请查看[https://console.aws.amazon.com/guardduty/](https://console.amazonaws.cn/guardduty/)控制台中的 **“设置**” 页面，或者运行 [https://docs.amazonaws.cn/guardduty/latest/APIReference/API_ListDetectors.html](https://docs.amazonaws.cn/guardduty/latest/APIReference/API_ListDetectors.html)API。`detectorId`

# 迁移到运行时监控后禁用 EKS 运行时监控
禁用 EKS 运行时监控

确认您账户或组织的现有设置已复制到运行时监控后，您可以禁用 EKS 运行时监控。

**禁用 EKS 运行时监控**
+ **在自己的账户中禁用 EKS 运行时监控**

  使用您自己的区域运行 [UpdateDetector](https://docs.amazonaws.cn/guardduty/latest/APIReference/API_UpdateDetector.html)API *detector-id*。

  或者，您可以使用以下 Amazon CLI 命令。*12abc34d567e8fa901bc2d34e56789f0*替换为你自己的区域*detector-id*。

  ```
  aws guardduty update-detector --detector-id 12abc34d567e8fa901bc2d34e56789f0 --features '[{"Name" : "EKS_RUNTIME_MONITORING", "Status" : "DISABLED"}]'
  ```
+ **为组织中的成员账户禁用 EKS 运行时监控**

  使用组织委派 GuardDuty 管理员账户*detector-id*的区域运行 [UpdateMemberDetectors](https://docs.amazonaws.cn/guardduty/latest/APIReference/API_UpdateMemberDetectors.html)API。

  或者，您可以使用以下 Amazon CLI 命令。*12abc34d567e8fa901bc2d34e56789f0*替换为组织*detector-id*委派 GuardDuty 管理员账户的区域以及*111122223333*要禁用此功能的成员账户的 Amazon Web Services 账户 ID。

  ```
  aws guardduty update-member-detectors --detector-id 12abc34d567e8fa901bc2d34e56789f0 --account-ids 111122223333 --features '[{"Name" : "EKS_RUNTIME_MONITORING", "Status" : "DISABLED"}]'
  ```
+ **更新组织的 EKS 运行时监控自动启用设置**

  仅在为组织中的新 (`NEW`) 或所有 (`ALL`) 成员账户配置了 EKS 运行时监控自动启用设置时，才执行以下步骤。如果已将其配置为 `NONE`，则可以跳过此步骤。
**注意**  
如果将 EKS 运行时监控自动启用配置设置为 `NONE`，则意味着不会为任何现有成员账户或在新成员账户加入组织时自动启用 EKS 运行时监控。

  使用组织委派 GuardDuty 管理员账户*detector-id*的区域运行 [UpdateOrganizationConfiguration](https://docs.amazonaws.cn/guardduty/latest/APIReference/API_UpdateOrganizationConfiguration.html)API。

  或者，您可以使用以下 Amazon CLI 命令。*12abc34d567e8fa901bc2d34e56789f0*替换为组织*detector-id*委托 GuardDuty 管理员账户的区域。将替换为*EXISTING\$1VALUE*当前配置以实现自动启用 GuardDuty。

  ```
  aws guardduty update-organization-configuration --detector-id 12abc34d567e8fa901bc2d34e56789f0 --auto-enable-organization-members EXISTING_VALUE --features '[{"Name" : "EKS_RUNTIME_MONITORING", "AutoEnable": "NONE"}]'
  ```