You can use the bucket inventory feature to export the information about specified objects in a bucket, such as the number, sizes, storage classes, and encryption status of the objects. Compared with the GetBucket (ListObjects) operation, we recommend that you use the bucket inventory feature to list a large number of objects.

Usage notes

  • You can configure up to 10 inventories for each bucket in the Object Storage Service (OSS) console and up to 1,000 inventories for each bucket by using OSS SDKs or ossutil.
  • You are charged if you use the bucket inventory feature. However, only storage fees for inventory lists and API calling fees are charged during public preview.
  • After an inventory is configured for a bucket, OSS generates inventory lists based on the inventory until the inventory is deleted. To save storage space, we recommend that you delete inventory lists that you no longer need in a timely manner.

For more information, see Bucket inventory.

Procedure

  1. In the left-side navigation pane, choose Basic Settings > Bucket Inventory. In the Bucket Inventory section, click Configure.
  2. Click Create Inventory. In the Create Inventory panel, configure the parameters in the following table.
    Parameter Description
    Status Set the status of the inventory. You can select Enabled or Disabled.
    Rule Name Set the name of the inventory. The name can contain only lowercase letters, digits, and hyphens (-) and cannot start or end with a hyphen (-).
    Destination Bucket Select the bucket in which generated inventory lists are stored.

    The source bucket for which an inventory is configured and the destination bucket in which the inventory lists are stored do not have to be the same bucket, but they must belong to the same account and reside within the same region.

    Inventory List Path Configure the directory in which generated inventory lists are stored.
    • If you want to store the inventory lists in the root directory of the destination bucket, leave the parameter empty.
    • Otherwise, specify the parameter as a full path of a directory, excluding the destination bucket name.

      For example, when you want to store the inventory lists in the exampledir1 path of the destination bucket named examplebucket, set the parameter to exampledir1. When you want to store the inventory lists in the exampledir2 subdirectory of the exampledir1 directory, set the parameter to exampledir1/exampledir2.

    Frequency Configure the frequency at which inventory lists are generated. You can select Weekly or Daily.
    We recommend that you configure inventories based on the number of objects in the source bucket:
    • If the number of objects in the source bucket is smaller than 1 billion, we recommend that you configure inventories to export inventory lists on a daily basis.
    • If the number of objects in the source bucket is between 1 billion and 10 billion, we recommend that you configure inventories to export inventory lists on a weekly basis.
    • If the number of objects in the source bucket is greater than 10 billion, we recommend that you configure different inventories based on object prefixes to generate inventory lists on a weekly basis and make sure the number of objects scanned based on each inventory does not exceed 10 billion.
    Encryption Method Specify whether to encrypt inventory lists.
    • None: Inventory lists are not encrypted.
    • AES-256: Inventory lists are encrypted by using AES-256.
    • KMS: Inventory lists are encrypted by using a customer master key (CMK) managed by Key Management Service (KMS).

      To use a CMK to encrypt inventory lists, you must create a CMK in KMS in the same region as the destination bucket. For more information about how to configure CMKs, see Create a CMK.

      Note You are charged for calling API operations when you use CMKs to encrypt or decrypt data.
    Object Versions Select the object version to which the inventory is applied.

    If versioning is enabled for the bucket, you can select Current Version or All Versions to generate inventory lists for the current version or all versions of objects in the bucket. For more information, see Overview.

    By default, inventory lists are generated for all objects in the bucket if versioning is not enabled for the bucket.

    Object Prefix Set the prefix based on which to scan objects.
    • To scan all objects in the bucket, do not specify this parameter.
    • To scan all objects in a directory of the bucket, set this parameter to the full path that does not include the bucket name.

      To scan all objects in the exampledir1 root directory of the examplebucket bucket, set this parameter to exampledir1/. To scan all objects in the exampledir2 subdirectory of the exampledir1 root directory, set this parameter to exampledir1/exampledir2/.

    Note If no objects in the bucket match the specified prefix, no inventory lists are generated.
    Optional Fields Select the object information that you want to export to inventory lists. You can select the following fields: Object Size, Storage Class, Last Update Time, ETag, Multipart Upload, and Encryption Status.
  3. Read and select I understand the terms and agree to authorize Alibaba Cloud OSS to access the resources in my buckets. Then, click OK.
    It may take a while to generate an inventory list for a large number of objects. If you want to be notified when the inventory list is generated for the objects, we recommend that you configure an event notification for the destination bucket in which the inventory list is stored and set the event to PutObject. When an inventory list is generated, a notification is sent to you. For more information about how to configure event notifications, see Configure event notification rules.