

# 从您的账户中删除第三方私有扩展
<a name="registry-private-deregister-extension"></a>

要移除第三方私有扩展或扩展版本，请使用 [https://docs.aws.amazon.com/cli/latest/reference/cloudformation/deregister-type.html](https://docs.aws.amazon.com/cli/latest/reference/cloudformation/deregister-type.html) 命令。

您可以取消注册特定的扩展版本或整个扩展。要取消注册扩展，您必须单独取消注册该扩展的所有已注册版本。如果扩展只有一个已注册的版本，则取消注册该版本会导致取消注册扩展本身。您无法取消注册扩展的默认版本，除非其是该扩展唯一的已注册版本，在这种情况下，扩展本身也会取消注册。

**警告**  
取消注册私有扩展程序的操作无法撤消。此操作将会：  
使该扩展程序无法在所有 CloudFormation 操作中使用。
导致使用此扩展程序的未来的堆栈更新失败（适用于模块和资源类型）。尽管您稍后可以自行重新注册该扩展程序，但如果 CloudFormation 依赖的是较早的版本，这样做可能会导致失败。
在继续操作之前，请使用 [list-stacks](https://docs.aws.amazon.com/cli/latest/reference/cloudformation/list-stacks.html) 和 [get-template](https://docs.aws.amazon.com/cli/latest/reference/cloudformation/get-template.html) 命令验证没有活动堆栈在使用此扩展程序。

## 取消注册扩展命令示例
<a name="registry-deregister-type-commands"></a>

本节提供的示例展示了取消注册私有扩展的不同方法。

**按类型名称取消注册**  
使用带 `--type` 和 `--type-name` 选项的 [https://docs.aws.amazon.com/cli/latest/reference/cloudformation/deregister-type.html](https://docs.aws.amazon.com/cli/latest/reference/cloudformation/deregister-type.html) 命令取消注册您的扩展。

```
aws cloudformation deregister-type \
  --type MODULE \
  --type-name My::S3::SampleBucket::MODULE
```

**按类型名称和版本取消注册**  
要取消注册扩展的特定版本，请在命令中指定 `--version-id` 选项。

```
aws cloudformation deregister-type \
  --type MODULE \
  --type-name My::S3::SampleBucket::MODULE \
  --version-id 00000001
```

**提示**  
要先将扩展的不同版本设置为默认版本，请使用 [set-type-default-version](https://docs.aws.amazon.com/cli/latest/reference/cloudformation/set-type-default-version.html) 命令。

**通过 ARN 取消注册**  
使用 `--arn` 选项并指定扩展的 ARN 来取消注册。

```
aws cloudformation deregister-type \
  --arn arn:aws:cloudformation:us-west-2:123456789012:type/resource/Organization-Service-Resource
```