

# 删除 Storage Lens 组
<a name="storage-lens-groups-delete"></a>

以下示例演示如何使用 Amazon S3 控制台、AWS Command Line Interface (AWS CLI) 和 适用于 Java 的 AWS SDK 删除 Amazon S3 Storage Lens 存储统计管理工具组。

## 使用 S3 控制台
<a name="delete-storage-lens-group-console"></a>

**删除 Storage Lens 组**

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

1. 在左侧导航窗格中，选择 **Storage Lens 组**。

1. 在 **Storage Lens 组**下，选择要删除的 Storage Lens 组旁的选项按钮。

1. 选择**删除**。将显示**删除 Storage Lens 组**对话框。

1. 再次选择**删除**即可永久删除 Storage Lens 组。
**注意**  
Storage Lens 组在删除后无法还原。

## 使用 AWS CLI
<a name="delete-storage-lens-group-cli"></a>

以下 AWS CLI 示例将删除名为 `marketing-department` 的 Storage Lens 组。要使用此示例命令，请将 `user input placeholders` 替换为您自己的信息。

```
aws s3control delete-storage-lens-group --account-id 111122223333 \ 
--region us-east-1 --name marketing-department
```

## 使用适用于 Java 的 AWS SDK
<a name="delete-storage-lens-group-sdk-java"></a>

以下 适用于 Java 的 AWS SDK 示例将删除账户 `111122223333` 中名为 `Marketing-Department` 的 Storage Lens 组。要使用此示例，请将 `user input placeholders` 替换为您自己的信息。

```
package aws.example.s3control;

import com.amazonaws.AmazonServiceException;
import com.amazonaws.SdkClientException;
import software.amazon.awssdk.auth.credentials.ProfileCredentialsProvider;
import software.amazon.awssdk.regions.Region;
import software.amazon.awssdk.services.s3control.S3ControlClient;
import software.amazon.awssdk.services.s3control.model.DeleteStorageLensGroupRequest;

public class DeleteStorageLensGroup {
    public static void main(String[] args) {
        String storageLensGroupName = "Marketing-Department";
        String accountId = "111122223333";

        try {
            DeleteStorageLensGroupRequest deleteStorageLensGroupRequest = DeleteStorageLensGroupRequest.builder()
                    .name(storageLensGroupName)
                    .accountId(accountId).build();
            S3ControlClient s3ControlClient = S3ControlClient.builder()
                    .region(Region.US_WEST_2)
                    .credentialsProvider(ProfileCredentialsProvider.create())
                    .build();
            s3ControlClient.deleteStorageLensGroup(deleteStorageLensGroupRequest);
        } catch (AmazonServiceException e) {
            // The call was transmitted successfully, but Amazon S3 couldn't process
            // it and returned an error response.
            e.printStackTrace();
        } catch (SdkClientException e) {
            // Amazon S3 couldn't be contacted for a response, or the client
            // couldn't parse the response from Amazon S3.
            e.printStackTrace();
        }
    }
}
```