

# 迁移到 `AmazonECS_FullAccess` 托管策略
<a name="security-iam-awsmanpol-amazonecs-full-access-migration"></a>

`AmazonEC2ContainerServiceFullAccess` 托管 IAM 策略已于 2021 年 1 月 29 日逐步停用，以响应 `iam:passRole` 权限内的安全调查发现。此权限授予对所有资源的访问权限，包括账户中角色的凭证。现在该策略已逐步停用，您无法将该策略附加到任何新的组、用户或角色。任何已附加策略的组、用户或角色都可以继续使用它。但是，我们建议您更新组、用户或角色，以使用 `AmazonECS_FullAccess` 托管策略。

授予的权限由 `AmazonECS_FullAccess` 策略包括将 ECS 用作管理员所需的完整权限列表。如果您当前使用的由 `AmazonEC2ContainerServiceFullAccess` 策略授予的权限中不在 `AmazonECS_FullAccess` 策略中，您可以将其添加到内联策略语句中。有关更多信息，请参阅 [Amazon Elastic Container Service AWS 托管策略](security-iam-awsmanpol.md)。

使用以下步骤确定您是否有任何组、用户或角色当前正在使用 `AmazonEC2ContainerServiceFullAccess` 托管 IAM 策略。然后，更新它们以分离早期的策略并附加 `AmazonECS_FullAccess` 策略。

**更新组、用户或角色以使用 AmazonECS\$1FullAccess 策略（AWS 管理控制台)**

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

1. 在导航窗格中，选择**策略**并搜索并选择 `AmazonEC2ContainerServiceFullAccess` 策略。

1. 选择**策略用法**选项卡，显示当前正在使用此策略的任何 IAM 角色。

1. 对于当前使用 `AmazonEC2ContainerServiceFullAccess` 策略的 IAM 角色，请选择角色，然后使用以下步骤分离逐步停用的策略并附加 `AmazonECS_FullAccess` 策略。

   1. 在**权限**选项卡上，选择 **AmazonEC2ContainerServiceFullAccess** 策略旁边的 **X**。

   1. 选择**添加权限**。

   1. 选择**直接附加现有策略**中，搜索并选择 **AmazonECS\$1FullAccess** 策略，然后选择**下一步:审核**。

   1. 查看更改，然后选择**添加权限**。

   1. 对使用 `AmazonEC2ContainerServiceFullAccess` 策略的每个组、用户或角色重复这些步骤。

**更新组、用户或角色以使用 `AmazonECS_FullAccess` 策略（AWS CLI)**

1. 使用 [https://docs.aws.amazon.com/cli/latest/reference/iam/generate-service-last-accessed-details.html](https://docs.aws.amazon.com/cli/latest/reference/iam/generate-service-last-accessed-details.html) 命令生成报告，其中包含有关上次使用逐步停用策略时的详细信息。

   ```
   aws iam generate-service-last-accessed-details \
        --arn arn:aws:iam::aws:policy/AmazonEC2ContainerServiceFullAccess
   ```

   输出示例：

   ```
   {
       "JobId": "32bb1fb0-1ee0-b08e-3626-ae83EXAMPLE"
   }
   ```

1. 将先前输出中的作业 ID 与 [https://docs.aws.amazon.com/cli/latest/reference/iam/get-service-last-accessed-details.html](https://docs.aws.amazon.com/cli/latest/reference/iam/get-service-last-accessed-details.html) 命令配合使用以检索服务的上次访问报告。此报告显示上次使用逐步停用策略的 IAM 实体的 Amazon 资源名称（ARN）。

   ```
   aws iam get-service-last-accessed-details \
         --job-id 32bb1fb0-1ee0-b08e-3626-ae83EXAMPLE
   ```

1. 使用以下命令之一将 `AmazonEC2ContainerServiceFullAccess` 策略与组、用户或角色分离。
   + [https://docs.aws.amazon.com/cli/latest/reference/iam/detach-group-policy.html](https://docs.aws.amazon.com/cli/latest/reference/iam/detach-group-policy.html)
   + [https://docs.aws.amazon.com/cli/latest/reference/iam/detach-role-policy.html](https://docs.aws.amazon.com/cli/latest/reference/iam/detach-role-policy.html)
   + [https://docs.aws.amazon.com/cli/latest/reference/iam/detach-user-policy.html](https://docs.aws.amazon.com/cli/latest/reference/iam/detach-user-policy.html)

1. 使用以下命令之一将 `AmazonECS_FullAccess` 策略附加到组、用户或角色。
   + [https://docs.aws.amazon.com/cli/latest/reference/iam/attach-group-policy.html](https://docs.aws.amazon.com/cli/latest/reference/iam/attach-group-policy.html)
   + [https://docs.aws.amazon.com/cli/latest/reference/iam/attach-role-policy.html](https://docs.aws.amazon.com/cli/latest/reference/iam/attach-role-policy.html)
   + [https://docs.aws.amazon.com/cli/latest/reference/iam/attach-user-policy.html](https://docs.aws.amazon.com/cli/latest/reference/iam/attach-user-policy.html)