Exporting S3 Storage Lens metrics to S3 Tables
You can configure Amazon S3 Storage Lens for Tables to export your storage analytics and insights to S3 Tables. When you enable S3 Tables export, Amazon S3 stores your metrics in read-only Apache Iceberg tables. These tables are in the AWS-managed aws-s3 table bucket. You can query them using SQL with AWS analytics services like Amazon Athena, Amazon Redshift, and Amazon EMR.
There is no additional charge for exporting S3 Storage Lens metrics to AWS-managed S3 Tables. Standard charges apply for table storage, table management, and requests on the tables. For more information, see Amazon S3 pricing
Enable S3 Tables export using the console
Sign in to the AWS Management Console and open the Amazon S3 console at https://console.aws.amazon.com/s3/
. -
In the left navigation pane, choose Storage Lens, and then choose the Table buckets tab.
-
In the list of dashboards, choose the dashboard that you want to edit, and then choose Edit.
-
In the Metrics export and publishing step, turn on the daily data export and choose the Table bucket destination type.
-
Proceed through the remaining steps, and then on the Review and create step, choose Submit.
After you enable S3 Tables export, it can take up to 48 hours for the first data to be available in the tables.
You can enable or disable export to S3 Tables by using the Amazon S3 console, Amazon S3 API, the AWS CLI, or AWS SDKs.
By default, records in your S3 tables don't expire. To help minimize storage costs for your tables, you can enable and configure record expiration for the tables. With this option, Amazon S3 automatically removes records from a table when the records expire. For more information, see Record expiration for tables.
Enable S3 Tables export using the AWS CLI
Before running the following commands, make sure that you have an up to date CLI version. See Installing or updating to the latest version of the AWS CLI.
The following example enables S3 Tables export for an Amazon S3 Storage Lens for Tables configuration by using the AWS CLI. To use this example, replace the user input placeholders with your own information.
The put-storage-lens-configuration operation replaces the entire configuration. Include all of the dashboard's existing settings, such as its scope and CloudWatch publishing, along with the export destination. To get the current configuration, use get-storage-lens-configuration.
The advancedMetricsCategories are optional. The free tier can also export to AWS-managed S3 Tables; omit advancedMetricsCategories to export free tier metrics only.
aws s3tables put-storage-lens-configuration --storage-lens-id=your-configuration-id--storage-lens-configuration '{ "id":"your-configuration-id", "isEnabled":true, "advancedMetricsCategories":[ "StorageMetrics", "ActivityMetrics", "MaintenanceMetrics" ], "dataExport":{ "storageLensTableDestination":{ "isEnabled":true } } }'
Enable S3 Tables export using the AWS SDKs
The following example enables S3 Tables export for an Amazon S3 Storage Lens for Tables configuration by using the AWS SDK for Python (Boto3). To use this example, replace the user input placeholders with your own information.
import boto3 s3tables = boto3.client('s3tables') response = s3tables.put_storage_lens_configuration( storageLensId='your-configuration-id', storageLensConfiguration={ 'id': 'your-configuration-id', 'isEnabled': True, 'advancedMetricsCategories': [ 'StorageMetrics', 'ActivityMetrics', 'MaintenanceMetrics' ], 'dataExport': { 'storageLensTableDestination': { 'isEnabled': True } } } )
For more information about using the AWS SDKs, see AWS SDKs and tools
Next steps
After enabling S3 Tables export, you can: