

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

# 刪除 Amazon S3 Storage Lens 儀表板
<a name="storage_lens_deleting"></a>

您無法刪除預設儀表板。不過，您可以停用它。在刪除您已建立的儀表板之前，請考慮下列事項：
+ 除了刪除儀表板之外，您還可以*停用*儀表板，以便將來可以重新啟用儀表板。如需詳細資訊，請參閱[使用 S3 主控台](storage_lens_console_disabling.md)。
+ 刪除儀表板會刪除與其相關聯的所有組態設定。
+ 刪除儀表板會使所有歷史指標資料無法使用。這些歷史資料仍會保留 15 個月。如果您想要再次存取此資料，請在與已刪除的主要區域相同的主要區域中建立具有相同名稱的儀表板。

## 使用適用於 Java 的 AWS 開發套件
<a name="S3DeleteStorageLensConfigurationJava"></a>

**Example – 刪除 Amazon S3 Storage Lens 儀表板組態**  
下列範例示範如何使用適用於 Java 的 SDK 刪除 S3 Storage Lens 組態：  

```
package aws.example.s3control;

import com.amazonaws.AmazonServiceException;
import com.amazonaws.SdkClientException;
import com.amazonaws.auth.profile.ProfileCredentialsProvider;
import com.amazonaws.services.s3control.AWSS3Control;
import com.amazonaws.services.s3control.AWSS3ControlClient;
import com.amazonaws.services.s3control.model.DeleteStorageLensConfigurationRequest;

import static com.amazonaws.regions.Regions.US_WEST_2;

public class DeleteDashboard {

    public static void main(String[] args) {
        String configurationId = "ConfigurationId";
        String sourceAccountId = "111122223333";
        try {
            AWSS3Control s3ControlClient = AWSS3ControlClient.builder()
                    .withCredentials(new ProfileCredentialsProvider())
                    .withRegion(US_WEST_2)
                    .build();

            s3ControlClient.deleteStorageLensConfiguration(new DeleteStorageLensConfigurationRequest()
                    .withAccountId(sourceAccountId)
                    .withConfigId(configurationId)
            );
        } 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();
        }
    }
}
```