

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

# 保护会员账户不被关闭 AWS Organizations
<a name="orgs_account_close_policy"></a>

要保护成员账户免遭意外关闭，可以创建一个 IAM 策略，指定哪些账户可免于关闭。此策略可防止受保护的成员账户遭到关闭。

使用以下方法之一创建 IAM 策略，拒绝账户关闭：
+ 使用受保护账户的 ARN 在策略的 `Resource` 元素中明确列出受保护的账户。
+ 标记个人账户，并使用 `aws:ResourceTag` 全局条件键来防止已标记账户被关闭。

**注意**  
服务控制策略（SCP）不会影响管理账户中的 IAM 主体。

## 防止成员账户关闭的 IAM policy 示例
<a name="orgs_close_account_policy_examples"></a>

以下代码示例显示了可用于限制成员账户关闭账户的不同方法。

------
#### [ Prevent member accounts with tags from getting closed  ]

您可以将以下策略附加到管理账户中的身份。此策略防止管理账户中的主体关闭任何标记为 `aws:ResourceTag` 标记全局条件键、`AccountType` 键和 `Critical` 标签值的成员账户。

```
{
    "Version": "2012-10-17",		 	 	 
    "Statement": [
        {
            "Sid": "PreventCloseAccountForTaggedAccts",
            "Effect": "Deny",
            "Action": "organizations:CloseAccount",
            "Resource": "*",
            "Condition": {
                "StringEquals": {"aws:ResourceTag/AccountType": "Critical"}
            }
        }
    ]
}
```

------
#### [ Prevent member accounts listed in this policy from getting closed ]

您可以将以下策略附加到管理账户中的身份。此策略可防止管理账户中的主体关闭 `Resource` 元素中明确指定的成员账户。

```
{
    "Version": "2012-10-17",		 	 	 
    "Statement": [
        {
            "Sid": "PreventCloseAccount",
            "Effect": "Deny",
            "Action": "organizations:CloseAccount",
            "Resource": [
                "arn:aws:organizations::555555555555:account/o-12345abcdef/123456789012",
                "arn:aws:organizations::555555555555:account/o-12345abcdef/123456789014"
            ]
        }
    ]
}
```

------
#### [ Prevent member accounts from closure with AWS Organizations ]

您可以将以下策略附加到管理账户中的身份。该政策通过拒绝和`organizations:CloseAccount`操作来防止管理账户中的委托人关闭任何成员账户。`account:CloseAccount`

```
{
    "Version": "2012-10-17",		 	 	 
    "Statement": [
        {
            "Effect": "Deny",
            "Action": [
                "account:CloseAccount",
                "organizations:CloseAccount"
                ],
            "Resource": "*"
        }
    ]
}
```

------