Change file storage class
Updated at:2025-11-03
As mentioned above, BOS supports four storage classes for files: STANDARD (standard storage), STANDARD_IA (infrequent access storage), COLD (cold storage) and ARCHIVE (archive storage). Meanwhile, the BOS python SDK also allows users to perform operations to change the storage class of specific files. The relevant parameters are as follows:
| Parameters | Description |
|---|---|
| x-bce-storage-class | Define the object's storage class. STANDARD_IA indicates infrequent access storage, COLD indicates cold storage, ARCHIVE indicates archive storage, and if no class is specified, the default is standard storage. |
Note
- When copying an archive-class source object using the copy_object() API, you must first restore the archived file by calling restore_object().
An example is as follows:
Python
1# Convert standard storage to infrequent access storage
2bos_client.copy_object(source_bucket_name, source_key,
3 target_bucket_name, target_key,
4 storage_class = storage_class.STANDARD_IA)
5# Convert infrequent access storage to cold storage
6bos_client.copy_object(source_bucket_name, source_key,
7 target_bucket_name, target_key,
8 storage_class = storage_class.COLD)
