

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

# 停用和啟用 CloudFormation 勾點
<a name="hooks-disable-enable"></a>

本主題說明如何停用再重新啟用勾點，暫時防止其在您的帳戶中處於作用中狀態。當您需要在不受勾點干擾的情況下調查問題時，停用勾點會很有用。

## 在帳戶中停用和啟用勾點 （主控台）
<a name="hooks-disable-enable-console"></a>

**在帳戶中停用勾點**

1. 登入 AWS 管理主控台 並開啟位於 https：//[https://console.aws.amazon.com/cloudformation](https://console.aws.amazon.com/cloudformation/) 的 CloudFormation 主控台。

1. 在畫面頂端的導覽列上，選擇 AWS 區域 勾點所在的 。

1. 從導覽窗格中，選擇**勾點**。

1. 選擇您要停用的勾點名稱。

1. 在勾點詳細資訊頁面的勾點名稱右側，選擇**停用**按鈕。

1. 出現確認提示時，請選擇**停用掛鉤**。

**重新啟用先前停用的勾點**

1. 登入 AWS 管理主控台 並開啟位於 https：//[https://console.aws.amazon.com/cloudformation](https://console.aws.amazon.com/cloudformation/) 的 CloudFormation 主控台。

1. 在畫面頂端的導覽列上，選擇 AWS 區域 勾點所在的 。

1. 從導覽窗格中，選擇**勾點**。

1. 選擇您要啟用的勾點名稱。

1. 在勾點詳細資訊頁面的勾點名稱右側，選擇**啟用**按鈕。

1. 出現確認提示時，請選擇**啟用勾點**。

## 在帳戶中停用和啟用勾點 (AWS CLI)
<a name="hooks-disable-enable-cli"></a>

**重要**  
停用和啟用勾點的 AWS CLI 命令會將整個勾點組態取代為 `--configuration`選項中指定的值。若要避免意外變更，您必須包含執行這些命令時要保留的所有現有設定。若要檢視目前的組態資料，請使用 [https://docs.aws.amazon.com/cli/latest/reference/cloudformation/describe-type.html](https://docs.aws.amazon.com/cli/latest/reference/cloudformation/describe-type.html)命令。

**停用勾點**  
使用下列[https://docs.aws.amazon.com/cli/latest/reference/cloudformation/set-type-configuration.html](https://docs.aws.amazon.com/cli/latest/reference/cloudformation/set-type-configuration.html)命令，並將 指定`HookInvocationStatus`為 `DISABLED`以停用勾點。將預留位置取代為您的特定值。

```
aws cloudformation set-type-configuration \
  --configuration "{"CloudFormationConfiguration":{"HookConfiguration":{"HookInvocationStatus": "DISABLED", "FailureMode": "FAIL", "TargetOperations": ["STACK","RESOURCE","CHANGE_SET"], "Properties":{}}}}" \
  --type-arn "arn:aws:cloudformation:us-west-2:123456789012:type/hook/MyTestHook" \
  --region us-west-2
```

**重新啟用先前停用的勾點**  
使用下列[https://docs.aws.amazon.com/cli/latest/reference/cloudformation/set-type-configuration.html](https://docs.aws.amazon.com/cli/latest/reference/cloudformation/set-type-configuration.html)命令，並將 指定`HookInvocationStatus`為 `ENABLED`以重新啟用勾點。將預留位置取代為您的特定值。

```
aws cloudformation set-type-configuration \
  --configuration "{"CloudFormationConfiguration":{"HookConfiguration":{"HookInvocationStatus": "ENABLED", "FailureMode": "FAIL", "TargetOperations": ["STACK","RESOURCE","CHANGE_SET"], "Properties":{}}}}" \
  --type-arn "arn:aws:cloudformation:us-west-2:123456789012:type/hook/MyTestHook" \
  --region us-west-2
```

如需詳細資訊，請參閱[勾點組態結構描述語法參考](hook-configuration-schema.md)。