

# 删除已注册位置
<a name="access-grants-location-delete"></a>

您可以从 Amazon S3 Access Grants 实例中删除位置注册。删除该位置会将其从 S3 Access Grants 实例取消注册。

您必须先删除与该位置关联的所有授权，之后才能从 S3 Access Grants 实例中删除位置注册。有关如何删除授权的信息，请参阅[删除授权](https://docs.aws.amazon.com/AmazonS3/latest/userguide/access-grants-grant-delete.html)。

您可以使用 Amazon S3 控制台、AWS Command Line Interface（AWS CLI）、Amazon S3 REST API 和 AWS SDK 从 S3 Access Grants 实例中删除位置。

## 使用 S3 控制台
<a name="access-grants-location-delete-console"></a>

**从 S3 Access Grants 实例中删除位置注册**

1. 登录到 AWS 管理控制台，然后通过以下网址打开 Amazon S3 控制台：[https://console.aws.amazon.com/s3/](https://console.aws.amazon.com/s3/)。

1. 在左侧导航窗格中，选择 **Access Grants**。

1. 在 **S3 Access Grants** 页面上，选择包含要使用的 S3 Access Grants 实例的区域。

1. 对于实例，选择**查看详细信息**。

1. 在实例的详细信息页面上，选择**位置**选项卡。

1. 找到要更新的位置。要筛选位置列表，请使用搜索框。

1. 选择要删除的已注册位置旁边的选项按钮。

1. 选择**注销**。

1. 这将出现一个对话框，警告您此操作无法撤消。要删除该位置，请选择**取消注册**。

## 使用 AWS CLI
<a name="access-grants-location-delete-cli"></a>

要安装 AWS CLI，请参阅 *AWS Command Line Interface 用户指南*中的[安装 AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html)。

要使用以下示例命令，请将 `user input placeholders` 替换为您自己的信息。

**Example – 删除位置注册**  

```
aws s3control delete-access-grants-location \
--account-id 111122223333 \
--access-grants-location-id  a1b2c3d4-5678-90ab-cdef-EXAMPLE11111 
 // No response body
```

## 使用 REST API
<a name="access-grants-location-delete-rest-api"></a>

有关用于从 S3 Access Grants 实例中删除位置的 Amazon S3 REST API 支持的信息，请参阅**《Amazon Simple Storage Service API 参考》中的 [https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_DeleteAccessGrantsLocation.html](https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_DeleteAccessGrantsLocation.html)。

## 使用 AWS SDK
<a name="access-grants-location-delete-using-sdk"></a>

此部分中的示例说明了如何使用 AWS SDK 删除位置。

要使用以下示例，请将 `user input placeholders` 替换为您自己的信息。

------
#### [ Java ]

**Example – 删除位置注册**  

```
public void deleteAccessGrantsLocation() {
DeleteAccessGrantsLocationRequest deleteRequest = DeleteAccessGrantsLocationRequest.builder()
.accountId("111122223333")
.accessGrantsLocationId("a1b2c3d4-5678-90ab-cdef-EXAMPLE11111")
.build();
DeleteAccessGrantsLocationResponse deleteResponse = s3Control.deleteAccessGrantsLocation(deleteRequest);
LOGGER.info("DeleteAccessGrantsLocationResponse: " + deleteResponse);
}
```
响应：  

```
DeleteAccessGrantsLocationResponse()
```

------