

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

# 从行为图中移除成员账户
<a name="accounts-invited-remove"></a>

管理员账户可以随时从行为图中删除受邀成员账户。

Detective 会自动删除终止于 AWS AWS GovCloud （美国东部）和 AWS GovCloud （美国西部）地区的成员账户。

从行为图中删除受邀成员账户时，会发生以下情况。
+ 该成员账户已从**我的成员账户**中删除。
+ Amazon Detective 会停止从已删除的账户提取数据。

Detective 不会从行为图中删除任何现有数据，因为行为图汇总了各成员账户的数据。

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

您可以使用 AWS 管理控制台 将受邀成员账户从行为图中移除。

**要删除成员账户（控制台）**

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

1. 在 Detective 导航窗格中，选择**账户管理**。

1. 在账户列表中，选择要删除的每个成员账户的复选框。

   无法从列表中删除自己的账户。

1. 选择**操作**。然后选择**禁用账户**。

------
#### [ Detective API/CLI  ]

你可以使用 Detective API 或 AWS Command Line Interface 将受邀成员账户从行为图中移除。要获取要在请求中使用的行为图的 ARN，请使用 [https://docs.aws.amazon.com/detective/latest/APIReference/API_ListGraphs.html](https://docs.aws.amazon.com/detective/latest/APIReference/API_ListGraphs.html) 操作。

**从行为图中移除受邀成员账号（Detective API， AWS CLI）**
+ **Detective API：**使用 [https://docs.aws.amazon.com/detective/latest/APIReference/API_DeleteMembers.html](https://docs.aws.amazon.com/detective/latest/APIReference/API_DeleteMembers.html) 操作。指定要删除的成员账户的图 ARN 和账户标识符列表。
+ **AWS CLI：**在命令行处，运行 [https://docs.aws.amazon.com/cli/latest/reference/detective/delete-members.html](https://docs.aws.amazon.com/cli/latest/reference/detective/delete-members.html) 命令。

  ```
  aws detective delete-members --account-ids <account ID list> --graph-arn <behavior graph ARN>
  ```

  示例：

  ```
  aws detective delete-members --account-ids 444455556666 123456789012 --graph-arn arn:aws:detective:us-east-1:111122223333:graph:123412341234
  ```

------
#### [ Python script ]

Detective 在中提供了一个开源脚本 GitHub。可以使用此脚本从管理员账户的行为图表中删除指定区域列表中的指定成员账户列表。

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

------