

文件 AWS 開發套件範例 GitHub 儲存庫中有更多可用的 [AWS SDK 範例](https://github.com/awsdocs/aws-doc-sdk-examples)。

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

# 搭配使用 `DeleteStack` 與 CLI
<a name="cloudformation_example_cloudformation_DeleteStack_section"></a>

下列程式碼範例示範如何使用 `DeleteStack`。

動作範例是大型程式的程式碼摘錄，必須在內容中執行。您可以在下列程式碼範例的內容中看到此動作：
+  [建立您的第一個 CloudFormation 堆疊](cloudformation_example_cloudformation_GettingStarted_021_section.md) 
+  [Amazon EKS 入門](cloudformation_example_eks_GettingStarted_034_section.md) 

------
#### [ CLI ]

**AWS CLI**  
**刪除堆疊**  
以下 `delete-stack` 範例會刪除指定的堆疊。  

```
aws cloudformation delete-stack \
    --stack-name {{my-stack}}
```
此命令不會產生輸出。  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [DeleteStack](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/cloudformation/delete-stack.html)。

------
#### [ PowerShell ]

**Tools for PowerShell V4**  
**範例 1：刪除指定的堆疊。**  

```
Remove-CFNStack -StackName "myStack"
```
+  如需 API 詳細資訊，請參閱《*AWS Tools for PowerShell Cmdlet 參考 (V4)*》中的 [DeleteStack](https://docs.aws.amazon.com/powershell/v4/reference)。

**Tools for PowerShell V5**  
**範例 1：刪除指定的堆疊。**  

```
Remove-CFNStack -StackName "myStack"
```
+  如需 API 詳細資訊，請參閱《*AWS Tools for PowerShell Cmdlet 參考 (V5)*》中的 [DeleteStack](https://docs.aws.amazon.com/powershell/v5/reference)。

------