

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

# 取消節點與 AWS OpsWorks for Chef Automate 伺服器的關聯
<a name="opscm-disassociate-node"></a>

**重要**  
AWS OpsWorks for Chef Automate 已於 2024 年 5 月 5 日終止服務，並已針對新客戶和現有客戶停用。我們建議現有客戶遷移至 Chef SaaS 或替代解決方案。如果您有任何問題，可以在 [AWS re：Post](https://repost.aws/) 或透過 [AWS Premium Support](https://aws.amazon.com/support) 聯絡 AWS 支援 團隊。

本節說明如何取消受管節點與 AWS OpsWorks for Chef Automate 伺服器管理的關聯或移除受管節點。此操作會在命令列上執行；您無法在 AWS OpsWorks for Chef Automate 管理主控台中取消節點的關聯。目前， AWS OpsWorks for Chef Automate API 不允許批次移除多個節點。本節中的命令會一次取消一個節點的關聯。

我們建議您在刪除伺服器前先從 Chef 伺服器取消與節點的關聯，使節點可在不嘗試重新連線到伺服器的情況下繼續運作。若要這樣做，請執行 [https://docs.aws.amazon.com/opsworks-cm/latest/APIReference/API_DisassociateNode.html](https://docs.aws.amazon.com/opsworks-cm/latest/APIReference/API_DisassociateNode.html) AWS CLI 命令。

**取消與節點的關聯**

1. 在 中 AWS CLI，執行下列命令來取消節點的關聯。*Node\$1name* 是您要取消關聯的節點名稱；對於 Amazon EC2 執行個體，這是執行個體 ID。*Server\$1name* 是您要將節點取消關聯的來源 Chef 伺服器名稱。`--engine-attributes` 會指定您的預設 `CHEF_AUTOMATE_ORGANIZATION` 名稱。這三個參數均為必要。

   `--region` 參數並非必要項目，除非您希望從不是位於您預設區域內的 Chef 伺服器取消與節點的關聯。

   ```
   aws opsworks-cm --region Region_name disassociate-node --node-name Node_name --server-name Server_name --engine-attributes "Name=CHEF_AUTOMATE_ORGANIZATION,Value='default'"
   ```

   下列是範例命令。

   ```
   aws opsworks-cm --region us-west-2 disassociate-node --node-name i-0010zzz00d66zzz90 --server-name opsworkstest --engine-attributes "Name=CHEF_AUTOMATE_ORGANIZATION,Value='default'"
   ```

1. 等待回應訊息指出取消關聯已完成。

   成功取消節點與 AWS OpsWorks for Chef Automate 伺服器的關聯後，節點仍會顯示在 Chef Automate 儀表板中。根據預設，Chef 會將節點狀態資訊強制保留一段時間，並在幾天後自動清除該節點。

如需如何刪除 AWS OpsWorks for Chef Automate 伺服器的詳細資訊，請參閱 [刪除 AWS OpsWorks for Chef Automate 伺服器](opscm-delete-server.md)。

## 相關主題
<a name="opscm-disassoc-related"></a>

下列 AWS 部落格文章提供有關使用 Auto Scaling 群組或在多個帳戶中自動將節點與 Chef Automate 伺服器建立關聯的詳細資訊。
+ [使用 AWS OpsWorks for Chef Automate 搭配 Auto Scaling 管理 EC2 執行個體](https://aws.amazon.com/blogs/mt/using-aws-opsworks-for-chef-automate-to-manage-ec2-instances-with-auto-scaling/)
+ [OpsWorks for Chef Automate – 自動引導不同帳戶中的節點](https://aws.amazon.com/blogs/mt/opsworks-for-chef-automate-automatically-bootstrapping-nodes-in-different-accounts/)