

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

# 關閉 Canary 版本
<a name="delete-canary-deployment"></a>

若要關閉 Canary 版本部署，請將 [https://docs.aws.amazon.com/apigateway/latest/api/API_Stage.html#canarySettings](https://docs.aws.amazon.com/apigateway/latest/api/API_Stage.html#canarySettings) 設為 null，以將它從階段中移除。

您可以使用 API Gateway 主控台、 AWS CLI或 AWS SDK 停用 Canary Release 部署。

**Topics**
+ [使用 API Gateway 主控台關閉 Canary 版本](#delete-canary-release-console)
+ [使用 關閉 Canary Release AWS CLI](#delete-canary-release-cli)

## 使用 API Gateway 主控台關閉 Canary 版本
<a name="delete-canary-release-console"></a>

若要使用 API Gateway 主控台關閉 Canary 版本部署，請執行下列步驟：

**關閉 Canary 版本部署**

1. 登入 API Gateway 主控台，然後在主導覽窗格中選擇現有 API。

1. 在主導覽窗格中，選擇**階段**，然後選擇現有的階段。

1.  選擇 **Canary** 索引標籤。

1.  選擇 **刪除**。

1.  選擇 **Delete (刪除)**，確認您要刪除 Canary。

因此，[https://docs.aws.amazon.com/apigateway/latest/api/API_Stage.html#canarySettings](https://docs.aws.amazon.com/apigateway/latest/api/API_Stage.html#canarySettings) 屬性會成為 `null`，並從部署[階段](https://docs.aws.amazon.com/apigateway/latest/api/API_Stage.html)中予以移除。您可以使用 驗證此項目 AWS CLI。如需範例，請參閱 [使用 關閉 Canary Release AWS CLI](#delete-canary-release-cli)。

## 使用 關閉 Canary Release AWS CLI
<a name="delete-canary-release-cli"></a>

以下 [update-stage](https://docs.aws.amazon.com/cli/latest/reference/apigateway/update-stage.html) 命令會關閉 Canary 發行部署：

```
aws apigateway update-stage \
    --rest-api-id abcd1234 \
    --stage-name canary \
    --patch-operations '[{"op":"remove", "path":"/canarySettings"}]'
```

輸出看起來如下：

```
{
    "stageName": "prod", 
    "accessLogSettings": {
        ...
    }, 
    "cacheClusterEnabled": false, 
    "cacheClusterStatus": "NOT_AVAILABLE", 
    "deploymentId": "nfcn0x", 
    "lastUpdatedDate": 1511309280, 
    "createdDate": 1511152939, 
    "methodSettings": {
        ...
    }
}
```

 如輸出中所示，已停用 Canary 部署的[階段](https://docs.aws.amazon.com/apigateway/latest/api/API_Stage.html)中不再有 [canarySettings](https://docs.aws.amazon.com/apigateway/latest/api/API_Stage.html#canarySettings) 屬性。