View a markdown version of this page

将 S3 Storage Lens 存储统计管理工具指标导出到 S3 表类数据存储服务 - Amazon Simple Storage Service
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)

将 S3 Storage Lens 存储统计管理工具指标导出到 S3 表类数据存储服务

您可以将 Amazon S3 Storage Lens 存储统计管理工具配置为将存储分析和见解导出到 S3 表类数据存储服务。启用 S3 表类数据存储服务导出后,您的指标将自动存储在 Amazon 托管的 aws-s3 表存储桶的只读 Apache Iceberg 表中,因此可以使用 SQL 以及 Amazon 分析服务(如 Amazon Athena、Amazon Redshift 和 Amazon EMR)对其进行查询。

注意

将 S3 Storage Lens 存储统计管理工具指标导出到 Amazon 托管的 S3 表类数据存储服务无需支付额外费用。表存储、表管理和对表的请求将收取标准费用。有关更多信息,请参阅 Amazon S3 定价

使用控制台启用 S3 表类数据存储服务导出

  1. 登录 Amazon 管理控制台并在 https://console.aws.amazon.com/s3/ 中打开 Amazon S3 控制台。

  2. 在左侧导航窗格中,选择 Storage Lens 存储统计管理工具Storage Lens 存储统计管理工具控制面板

  3. Storage Lens 存储统计管理工具控制面板列表中,选择要编辑的控制面板。

  4. 选择编辑

  5. 控制面板页面上,导航到指标导出和发布部分。

  6. 要为默认指标报告启用表导出,请在“存储桶类型”中选择表存储桶

  7. 要为扩展前缀指标报告启用表导出,请在“存储桶类型”中选择表存储桶

  8. 审核控制面板配置,然后单击提交

注意

启用 S3 表类数据存储服务导出后,最长可能需要 48 小时才会在表中提供第一批数据。

注意

将 S3 Storage Lens 存储统计管理工具指标导出到 Amazon 托管的 S3 表类数据存储服务无需支付额外费用。表存储、表管理、对表的请求和监控将收取标准费用。您可以使用 Amazon S3 控制台、Amazon S3 API、Amazon CLI 或 Amazon SDK 来启用或禁用导出到 S3 表类数据存储服务。

注意

默认情况下,S3 表中的记录不会过期。为了帮助尽可能降低表的存储成本,您可以为表启用和配置记录过期。使用此选项,当记录过期时,Amazon S3 会自动从表中删除记录。请参阅:表的记录过期时间

使用 Amazon CLI 启用 S3 表类数据存储服务导出

注意

在运行以下命令之前,请确保您具有最新的 CLI 版本。请参阅安装或更新到最新版本的 Amazon CLI

以下示例使用 Amazon CLI 为 S3 Storage Lens 存储统计管理工具配置“默认指标报告”启用 S3 表类数据存储服务导出。要使用此示例,请将用户输入占位符 替换为您自己的信息。

aws s3control put-storage-lens-configuration --account-id=555555555555 --config-id=your-configuration-id --storage-lens-configuration '{ "Id":"your-configuration-id", "AccountLevel":{ "ActivityMetrics":{ "IsEnabled":true }, "BucketLevel":{ "ActivityMetrics":{ "IsEnabled":true } } }, "DataExport":{ "S3BucketDestination":{ "OutputSchemaVersion":"V_1", "Format":"CSV", "AccountId":"555555555555", "Arn":"arn:aws:s3:::my-export-bucket", "Prefix":"storage-lens-exports/" }, "StorageLensTableDestination":{ "IsEnabled":true } }, "IsEnabled":true }'

使用 Amazon SDK 启用 S3 表类数据存储服务导出

以下示例使用适用于 Python 的 Amazon SDK(Boto3)为 S3 Storage Lens 存储统计管理工具配置“默认指标报告”启用 S3 表类数据存储服务导出。要使用此示例,请将用户输入占位符 替换为您自己的信息。

import boto3 s3control = boto3.client('s3control') response = s3control.put_storage_lens_configuration( AccountId='555555555555', ConfigId='your-configuration-id', StorageLensConfiguration={ 'Id': 'your-configuration-id', 'AccountLevel': { 'ActivityMetrics': { 'IsEnabled': True }, 'BucketLevel': { 'ActivityMetrics': { 'IsEnabled': True } } }, 'DataExport': { 'S3BucketDestination': { 'OutputSchemaVersion': 'V_1', 'Format': 'CSV', 'AccountId': '555555555555', 'Arn': 'arn:aws:s3:::my-export-bucket', 'Prefix': 'storage-lens-exports/' }, 'StorageLensTableDestination': { 'IsEnabled': True } }, 'IsEnabled': True } )

有关使用 Amazon SDK 的更多信息,请参阅 Amazon SDK 和工具

后续步骤

启用 S3 表类数据存储服务导出后,您可以: