OSS provides the bucket inventory feature to regularly export information about objects and store that information as an object in a specified bucket. This feature helps you understand the status of objects in your buckets as well as simplify and speed up workflows and big data tasks.

After you enable the bucket inventory feature, OSS scans objects in your buckets on a or weekly basis, generates an inventory list in the CSV format, and stores the list as an object in a specified bucket. You can specify object metadata you want to export to the inventory list such as object sizes and encryption statuses.
Note Only the metadata of objects is scanned and exported to inventory lists. The content of objects is not scanned.

Implementation modes

Implementation mode Description
Console A user-friendly and intuitive web application
ossutil A high-performance command-line tool

Function

After you create an inventory for a bucket, OSS generates inventory lists at the frequency specified in the inventory and stores the lists and related data in the following folder structure:
- dst_bucket/
 - destination-prefix/
   - src_bucket/
     - inventory_id/
       - YYYY-MM-DDTHH-MMZ/
         - manifest.json
         - manifest.checksum
       - data/
         - 745a29e3-bfaa-490d-9109-47086afcc8f2.csv.gz
  • destination-prefix/: the folder generated based on the inventory list prefix specified in the inventory. If the prefix is not specified, this folder level is omitted. This way, the following folder structure is used to store inventory lists and related data: dst_bucket/src_bucket/…….
  • src_bucket/: the generated folder corresponding to the bucket for which the inventory is configured.
  • inventory_id/: the generated folder corresponding to the name of the inventory.
  • YYY-MM-DDTHH-MMZ/: The folder name is a timestamp in GMT when the bucket is scanned. Example: 2020-05-17T16-00Z. The manifest.json and manifest.checksum objects are stored in this folder.
  • data/: the folder that stores inventory lists.
After an inventory is created for a bucket, the following objects are generated based on the inventory:
  • Inventory lists
    Inventory lists contain the exported object information and are stored in the data folder. You can query the fileSchema field in manifest.json to obtain the field columns included in the inventory lists. A complete inventory list includes the following field columns from left to right: Bucket, Key, VersionId, IsLatest, IsDeleteMarker, Size, LastModifiedDate, ETag, StorageClass, IsMultipartUploaded, and EncryptionStatus. Inventory list
    Field Description
    Bucket The name of the bucket for which the inventory is created.
    Key The URL-encoded name of the bucket object. You must decode the object name before you can view it.
    VersionId The version ID of the object. If versioning is enabled for the bucket, you can choose to export either the current version or all versions of objects when you configure inventories for the bucket. If you choose to export only the current version of objects, this field column is not included in inventory lists. For more information about versioning, see Overview.
    IsLatest If an object has multiple versions and the current version is the latest version, the value of this field is True. Otherwise, the value of this field is False. If you choose to export only the current version of objects, this field column is not included in inventory lists.
    IsDeleteMarker If an object has multiple versions and the current version is a delete marker, the value of this field is True. Otherwise, the value of this field is False. If you choose to export only the current version of objects, this field column is not included in inventory lists.
    Size The size of the object.
    LastModifiedDate The time when the object is last modified.
    ETag The ETag that is generated when an object is created. ETags are used to identify the content of the objects.
    • If an object is created by using PutObject, the ETag of the object is the MD5 hash of the object content.
    • If an object is created in other methods, the ETag of the object is the UUID of the object content.
    StorageClass The storage class of the object.
    IsMultipartUploaded A field that indicates whether the object is created by using multipart upload. If the object is created by using multipart upload, the value of this field is True. Otherwise, the value of this field is False.
    EncryptionStatus The encryption status of the object. If the object is encrypted, the value of this field is True. Otherwise, the value of this field is False.
  • manifest objects
    manifest objects:
    • manifest.json: stores the metadata of inventory lists and related information, including the following fields:
      • creationTimestamp: a UNIX timestamp, which indicates the time when OSS starts to scan objects in the bucket to generate an inventory list.
      • destinationBucket: the bucket that stores the inventory lists.
      • fileFormat: the format of the inventory lists.
      • fileSchema: the field columns included in the inventory lists.
      • files: the name, size, and MD5 hash of the inventory lists.
      • sourceBucket: the bucket for which the inventory is configured.
      • version: the version of the inventory lists.
    • manifest.checksum: stores the MD5 hash of manifest.json.

Usage notes

  • When you export the inventory lists, the final lists may not contain all objects due to operations such as creation, deletion, overwriting. Objects that are last modified before createTimeStamp in manifest.json are exported to the inventory lists. We recommend that you check the object attributes by using HeadObject before you export the object. For more information, see HeadObject.
  • You can configure a maximum of 1,000 inventories for a bucket. A maximum of 10 inventories can be configured and displayed in the OSS console.
  • The inventory list must be stored in a bucket within the same region as the bucket for which the inventory is configured.
  • We recommend that you configure the inventory tasks based on the number of objects in the source bucket:
    • If the number of objects is between 1 to 10 billion, OSS generates inventory lists in weeks.
    • If the number of objects is greater than 10 billion, we recommend that you configure different inventory tasks based on different object prefixes in weeks, and ensure that the number of each inventory task for objects is smaller than 10 billion.
  • If no objects are stored in the bucket for which the inventory is configured or no objects apply to the prefix specified in the inventory, inventory lists are not generated.
  • To use API operations, SDKs, or ossutil to configure inventories for a bucket, you must create a RAM role that has read permissions on all objects in the bucket and write permissions on the destination bucket that stores inventory lists. For more information about how to create a RAM role, see Create a RAM role for a trusted Alibaba Cloud service.
  • When you configure inventories in the OSS console, a role named AliyunOSSRole is generated. If you use a RAM user to configure inventories, the RAM user must have the permissions to call the role.
  • After an inventory is configured for a bucket, OSS generates inventory lists based on the inventory until the inventory is deleted. We recommend that you delete inventory lists that you no longer use in a timely manner to save storage space.

FAQ

How do I know whether an inventory list is generated?

If the number of objects in your bucket is large, it takes a period of time for OSS to generate inventory lists. If you want to be notified immediately after an inventory list is generated, we recommend that you configure an event notification rule. You can configure a notification rule for PutObject events for the destination bucket that stores generated inventory lists. This way, you can be notified when an inventory list is generated. For more information about how to configure event notification, see Configure event notification.