

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 使用 保護成員帳戶免於關閉 AWS Organizations
<a name="orgs_account_close_policy"></a>

為了保護成員帳戶免於意外關閉，請建立 IAM 政策來指定哪些帳戶可豁免。此政策可防止關閉受保護的成員帳戶。

建立 IAM 政策以拒絕使用下列其中一種方法關閉帳戶：
+ 使用政策的 ARNs 明確列出政策`Resource`元素中的受保護帳戶。
+ 標記個別帳戶並使用`aws:ResourceTag`全域條件金鑰，以防止關閉已標記的帳戶。

**注意**  
服務控制政策 SCPs) 不會影響管理帳戶中的 IAM 主體。

## 防止關閉成員帳戶的範例 IAM 政策
<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"
            ]
        }
    ]
}
```

------