

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

# 启用 Detective
<a name="detective-enabling"></a>

您可以通过 Detective 控制台、Detective API 或 AWS Command Line Interface启用 Detective。

您在每个区域只能启用一次 Detective。如果您已经是该区域中某个行为图的管理员账户，则无法在该区域中再次启用 Detective。

------
#### [ Console ]

**要启用 Detective（控制台）**

1. 登录到 AWS 管理控制台。然后打开 Detective 控制台，网址为[https://console.aws.amazon.com/detective/](https://console.aws.amazon.com/detective/)。

1. 选择**开始**。

1. 在 “**启用 Amazon Detectiv** e” 页面上，**对齐管理员账户（推荐）**解释了在 Detective GuardDuty 和 Amazon 之间调整管理员账户的建议 AWS Security Hub CSPM。请参阅[建议与 GuardDuty 和对齐 AWS Security Hub CSPM](detective-recommendations.md#recommended-service-alignment)。

1. “**附加 IAM 策略**” 按钮可将您直接带到 IAM 控制台并打开推荐的策略。您可以选择将推荐的策略附加到用于 Detective 的委托人。如您果没有在 IAM 控制台中操作的权限，则可以在**所需权限**中复制策略 Amazon 资源名称（ARN），将其提供给 IAM 管理员。他们可以代表您附加策略。

   确认所需的 IAM 策略已落实到位。

1. 您可以通过**添加标签**部分向行为图添加标签。

   要添加标签，请执行以下操作：

   1. 选择**添加新标签**。

   1. 对于**键**，输入标签的名称。

   1. 对于**值**，输入标签的值。

   要删除标签，请为该标签选择**删除**选项。

1. 选择**启用 Amazon Detective**。

1. 启用 Detective 后，就可以邀请成员账户访问行为图。

   要导航到**账户管理**页面，请选择**立即添加成员**。有关邀请成员账户的信息，请参阅[在 Detective 中管理受邀成员账户](accounts-invited-members.md)。

------
#### [ Detective API, AWS CLI ]

您可以通过 Detective API 或 AWS Command Line Interface启用 Amazon Detective。

**要启用 Detective（Detective API， AWS CLI）**
+ **Detective API：**使用 [https://docs.aws.amazon.com/detective/latest/APIReference/API_CreateGraph.html](https://docs.aws.amazon.com/detective/latest/APIReference/API_CreateGraph.html) 操作。
+ **AWS CLI：**在命令行处，运行 [https://docs.aws.amazon.com/cli/latest/reference/detective/create-graph.html](https://docs.aws.amazon.com/cli/latest/reference/detective/create-graph.html) 命令。

  ```
  aws detective create-graph --tags '{"tagName": "tagValue"}'
  ```

  以下命令将启用 Detective 并将 `Department` 标签的值设置为 `Security`。

  ```
  aws detective create-graph --tags '{"Department": "Security"}'
  ```

------
#### [ Python script on GitHub ]

你可以使用 Detective Python 脚本启用跨区域侦探 GitHub。Detective 提供了一个开源脚本 GitHub ，用于执行以下操作：
+ 为指定区域列表中的管理员账户启用 Detective
+ 将提供的成员账户列表添加到生成的每个行为图中
+ 向成员账号发送邀请电子邮件
+ 自动接受成员账户的邀请

有关如何配置和使用 GitHub 脚本的信息，请参见[使用 Detective Python 脚本管理账户](detective-github-scripts.md)。

------

## 检查 Detective 是否正在从你的账户中提取数据 AWS
<a name="enable-check-data"></a>

启用 Detective 后，它会开始从你的 AWS 账户中提取数据并将其提取到你的行为图中。

对于初始提取，数据通常会在 2 小时内出现在行为图中。

检查 Detective 是否正在提取数据的一种方法是在 Detective **搜索**页面上查找示例值。

**要在“搜索”页面上查看示例值**

1. 通过 [https://console.aws.amazon.com/detective/](https://console.aws.amazon.com/detective/) 打开 Amazon Detective 控制台。

1. 在导航窗格中，选择**搜索**。

1. 从**选择类型**菜单中，选择一种项目类型。

   **数据示例**包含行为图数据中选定类型标识符的样本集。

   如果出现示例值，就说明数据已被采集并提取到行为图中。