View a markdown version of this page

將 S3 Storage Lens 指標匯出至 S3 資料表 - Amazon Simple Storage Service

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

將 S3 Storage Lens 指標匯出至 S3 資料表

您可以設定 Amazon S3 Storage Lens 將儲存分析和洞見匯出至 S3 Tables。當您啟用 S3 Tables 匯出時,您的指標會自動儲存在 AWS受管資料表儲存貯體中的唯讀 Apache Iceberg aws-s3資料表中,使其可使用 SQL 搭配 Amazon Athena、Amazon Redshift 和 Amazon EMR 等 AWS 分析服務來查詢。

注意

將 S3 Storage Lens 指標匯出至 AWS受管 S3 資料表無需額外費用。資料表儲存、資料表管理和資料表上的請求需支付標準費用。如需詳細資訊,請參閱 Simple Storage Service (Amazon S3) 定價

使用主控台啟用 S3 Tables 匯出

  1. 登入 AWS 管理主控台,並在 https://https://console.aws.amazon.com/s3/ 開啟 Amazon S3 主控台。

  2. 在左側導覽窗格中,選擇 Storage Lens,然後選擇 Storage Lens Dashboards

  3. Storage Lens 儀表板清單中,選擇您要編輯的儀表板。

  4. 選擇編輯

  5. 儀表板頁面上,導覽至指標匯出和發佈區段。

  6. 若要啟用預設指標報告的資料表匯出,請在儲存貯體類型中選取資料表儲存貯體。

  7. 若要啟用擴展字首指標報告的資料表匯出,請在儲存貯體類型中選取資料表儲存貯體。

  8. 檢閱儀表板組態,然後按一下提交

注意

啟用 S3 Tables 匯出後,資料表中最多可能需要 48 小時才能使用第一個資料。

注意

將 S3 Storage Lens 指標匯出至 AWS受管 S3 資料表無需額外費用。標準費用適用於資料表儲存、資料表管理、資料表上的請求和監控。您可以使用 Amazon S3 主控台、Amazon S3 API AWS CLI、 或 AWS SDKs,啟用或停用匯出至 Amazon S3 資料表。 Amazon S3

注意

根據預設,S3 資料表中的記錄不會過期。為了協助將資料表的儲存成本降至最低,您可以啟用和設定資料表的記錄過期時間。使用此選項時,Amazon S3 會在記錄過期時自動從資料表中移除記錄。請參閱:記錄資料表的過期時間。

使用 啟用 S3 Tables 匯出 AWS CLI

注意

在執行下列命令之前,請確定您擁有最新的 CLI 版本。請參閱安裝或更新至最新版本的 AWS CLI

下列範例使用 啟用 S3 Storage Lens 組態「預設指標報告」的 S3 Tables 匯出 AWS CLI。若要使用此範例,請以您自己的資訊取代使用者輸入預留位置

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 }'

使用 AWS SDKs 啟用 S3 資料表匯出

下列範例使用適用於 Python 的 AWS SDK (BotoS3) 啟用 S3 Storage Lens 組態「預設指標報告」的 S3 Tables 匯出。若要使用此範例,請以您自己的資訊取代使用者輸入預留位置

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 } )

如需使用 AWS SDKs的詳細資訊,請參閱 AWS SDKs和工具

後續步驟

啟用 S3 Tables 匯出後,您可以: