

文档 AWS SDK 示例 GitHub 存储库中还有更多 [S AWS DK 示例](https://github.com/awsdocs/aws-doc-sdk-examples)。

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 将 `DeregisterOnPremisesInstance` 与 CLI 配合使用
<a name="codedeploy_example_codedeploy_DeregisterOnPremisesInstance_section"></a>

以下代码示例演示如何使用 `DeregisterOnPremisesInstance`。

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

**AWS CLI**  
**注销本地实例**  
以下`deregister-on-premises-instance`示例向注销本地实例 AWS CodeDeploy，但它不会删除与该实例关联的 IAM 用户，也不会在本地实例标签中取消与 AWS CodeDeploy 该实例的关联。它也不会从实例中卸载 AWS CodeDeploy 代理，也不会从实例中删除本地配置文件。  

```
aws deploy deregister-on-premises-instance --instance-name AssetTag12010298EX
```
此命令不生成任何输出。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[DeregisterOnPremisesInstance](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/deploy/deregister-on-premises-instance.html)*中的。

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

**适用于 PowerShell V4 的工具**  
**示例 1：此示例取消注册具有指定名称的本地实例。**  

```
Unregister-CDOnPremiseInstance -InstanceName AssetTag12010298EX
```
+  有关 API 的详细信息，请参阅 *AWS Tools for PowerShell Cmdlet 参考 (V* 4) [DeregisterOnPremisesInstance](https://docs.aws.amazon.com/powershell/v4/reference)中的。

**适用于 PowerShell V5 的工具**  
**示例 1：此示例取消注册具有指定名称的本地实例。**  

```
Unregister-CDOnPremiseInstance -InstanceName AssetTag12010298EX
```
+  有关 API 的详细信息，请参阅 *AWS Tools for PowerShell Cmdlet 参考 (V* 5) [DeregisterOnPremisesInstance](https://docs.aws.amazon.com/powershell/v5/reference)中的。

------