Managing metadata export of bucket objects (S3 Inventory)
In Object Storage, you can export metadata of bucket objects (S3 Inventory) for further analysis and cataloging.
Warning
Object metadata export (S3 Inventory) is currently in Preview and is provided free of charge. Going forward, this will be a paid feature.
No fees will apply to LIST and HEAD operations performed when using S3 Inventory.
PUT operations and data storage in the target bucket are billable. For more information, see the Object Storage pricing policy.
Creating an export configuration
If you do not have the Yandex Cloud CLI yet, install and initialize it.
The folder used by default is the one specified when creating the CLI profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also set a different folder for any specific command using the --folder-name or --folder-id options.
-
View the description of the CLI command to create an export configuration:
yc storage bucket create-inventory-configuration --help -
Create an export configuration:
yc storage bucket create-inventory-configuration \ --name <bucket_name> \ --configuration '{ "id": "test_config", "is_enabled": true, "schedule": { "frequency": "DAILY" }, "destination": { "bucket_destination": { "bucket": "<target_bucket_name>", "format": "CSV", "prefix": "inventory" } }, "filter": { "prefix": "for_inventory" }, "included_object_versions": "ALL", "optional_fields": [ "SIZE", "LAST_MODIFIED_DATE", "STORAGE_CLASS", "ETAG", "IS_MULTIPART_UPLOADED", "ENCRYPTION_STATUS", "OBJECT_LOCK_RETAIN_UNTIL_DATE", "OBJECT_LOCK_MODE", "OBJECT_LOCK_LEGAL_HOLD_STATUS", "CHECKSUM_ALGORITHM", "OBJECT_ACCESS_CONTROL_LIST", "OBJECT_OWNER" ] }'Where:
--name: Name of the bucket whose object metadata you want to export.--configuration: Export configuration options:id: Configuration ID. This is a required setting.is_enabled: Flag to enable or disable the configuration.frequency: Export frequency. This is a required setting. The possible values are:DAILY: Once a day.WEEKLY: Once a week.
destination: Information on where and how to publish export results:bucket: Name of the bucket for metadata export. The source and target buckets must be in the same cloud. This is a required setting.format: Export results format. OnlyCSVis supported. This is a required setting.prefix: Folder (prefix) to generate export results in.
included_object_versions: Versions of objects to include in the export list. This is a required setting. The possible values are:ALL: All versions.CURRENT: Current version.
filter: Filter for objects to include in the export. In theprefixfield, specify a folder containing the objects to include in the export list. This is an optional setting.optional_fields: Array of exported metadata types:SIZE: Object size in bytes.LAST_MODIFIED_DATE: Date the object was created or last modified.STORAGE_CLASS: Storage class.ETAG: Object hash.IS_MULTIPART_UPLOADED: Indicates whether the object was uploaded via a multipart upload.ENCRYPTION_STATUS: Object encryption status.OBJECT_LOCK_RETAIN_UNTIL_DATE: Expiration date of the object version lock.OBJECT_LOCK_MODE: Type of the object version lock.OBJECT_LOCK_LEGAL_HOLD_STATUS: Object version legal hold status.CHECKSUM_ALGORITHM: Algorithm used to compute the object checksum.OBJECT_ACCESS_CONTROL_LIST: Object access control list (ACL).OBJECT_OWNER: Object owner.
You can also create a configuration file in JSON format and provide it in this command:
yc storage bucket create-inventory-configuration \ --name <bucket_name> \ --configuration "$(cat <file_path>)"File contents example
{ "id": "test_config", "is_enabled": true, "schedule": { "frequency": "WEEKLY" }, "destination": { "bucket_destination": { "bucket": "<target_bucket_name>", "format": "CSV", "prefix": "inventory" } }, "included_object_versions": "ALL", "optional_fields": [ "SIZE", "LAST_MODIFIED_DATE", "STORAGE_CLASS", "ETAG", "IS_MULTIPART_UPLOADED", "ENCRYPTION_STATUS", "OBJECT_LOCK_RETAIN_UNTIL_DATE", "OBJECT_LOCK_MODE", "OBJECT_LOCK_LEGAL_HOLD_STATUS", "CHECKSUM_ALGORITHM", "OBJECT_ACCESS_CONTROL_LIST", "OBJECT_OWNER" ] }
To create an export configuration, use the createInventoryConfiguration REST API method for the Bucket resource or the BucketService.CreateInventoryConfiguration gRPC API call.
Downloading export results
You will get results in multiple files:
-
Manifest:
-
<export_prefix>/<source_bucket_name>/<configuration_ID>/<export_date>/manifest.json: Export manifest. -
<export_prefix>/<source_bucket_name>/<configuration_ID>/<export_date>/manifest.checksum: Manifest checksums.Where:
<export_prefix>: Prefix used for the export.<source_bucket_name>: Name of the source bucket for metadata export.<configuration_ID>: Export configuration ID.<export_date>: Export date inYYYY-MM-DDThh:mmZformat.
-
-
Report:
<export_prefix>/<source_bucket_name>/<configuration_ID>/data/<report_name>.csv, where<report_name>is the report UUID .For large buckets, the report may be split into multiple files.
You can download export results just like other objects.
Getting a list of export configurations
If you do not have the Yandex Cloud CLI yet, install and initialize it.
The folder used by default is the one specified when creating the CLI profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also set a different folder for any specific command using the --folder-name or --folder-id options.
-
View the description of the CLI command for viewing a list of export configurations:
yc storage bucket list-inventory-configurations --help -
Get a list of export configurations for the bucket:
yc storage bucket list-inventory-configurations <bucket_name>Result:
configurations: - id: test_config destination: bucket_destination: bucket: test-bucket format: CSV prefix: inventory included_object_versions: ALL is_enabled: true schedule: frequency: DAILY optional_fields: - SIZE - LAST_MODIFIED_DATE - STORAGE_CLASS - ETAG - IS_MULTIPART_UPLOADED - ENCRYPTION_STATUS - OBJECT_LOCK_RETAIN_UNTIL_DATE - OBJECT_LOCK_MODE - OBJECT_LOCK_LEGAL_HOLD_STATUS - CHECKSUM_ALGORITHM - OBJECT_ACCESS_CONTROL_LIST - OBJECT_OWNER
To view a list of export configurations, use the listInventoryConfigurations REST API method for the Bucket resource or the BucketService.ListInventoryConfigurations gRPC API call.
Getting information about an export configuration
If you do not have the Yandex Cloud CLI yet, install and initialize it.
The folder used by default is the one specified when creating the CLI profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also set a different folder for any specific command using the --folder-name or --folder-id options.
-
See the description of the CLI command to view an export configuration:
yc storage bucket get-inventory-configuration --help -
Get a list of export configurations for the bucket and copy the value in the
idfield of the configuration you need. -
Get information about an export configuration:
yc storage bucket get-inventory-configuration <bucket_name> --id <export_ID>Result:
id: test_config destination: bucket_destination: bucket: test-bucket format: CSV prefix: inventory included_object_versions: ALL is_enabled: true schedule: frequency: DAILY optional_fields: - SIZE - LAST_MODIFIED_DATE - STORAGE_CLASS - ETAG - IS_MULTIPART_UPLOADED - ENCRYPTION_STATUS - OBJECT_LOCK_RETAIN_UNTIL_DATE - OBJECT_LOCK_MODE - OBJECT_LOCK_LEGAL_HOLD_STATUS - CHECKSUM_ALGORITHM - OBJECT_ACCESS_CONTROL_LIST - OBJECT_OWNER
To get information about an export configuration, use the getInventoryConfiguration REST API method for the Bucket resource or the BucketService.GetInventoryConfiguration gRPC API call.
Deleting an export configuration
If you do not have the Yandex Cloud CLI yet, install and initialize it.
The folder used by default is the one specified when creating the CLI profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also set a different folder for any specific command using the --folder-name or --folder-id options.
-
View the description of the CLI command for deleting an export configuration:
yc storage bucket delete-inventory-configuration --help -
Get a list of export configurations for the bucket and copy the configuration
idfield value. -
Delete the export configuration:
yc storage bucket delete-inventory-configuration <bucket_name> --id <export_ID>
To delete an export configuration, use the deleteInventoryConfiguration REST API method for the Bucket resource or the BucketService.DeleteInventoryConfiguration gRPC API call.