Change file storage class
Updated at:2025-11-03
As mentioned, BOS supports three file storage classes: STANDARD (standard storage), STANDARD_IA (infrequent access storage), and COLD (cold storage). Additionally, the BOS Ruby SDK allows users to switch file storage classes.
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, and if no class is specified, the default is standard storage. |
An example is as follows:
Ruby
1options = {
2 Http::BOS_STORAGE_CLASS => 'STANDARD_IA'
3}
4# Convert standard storage to infrequent access storage
5client.copy_object(bucket_name, object_name, bucket_name, object_name, options)
6puts client.get_object_meta_data(bucket_name, object_name)[Http::BOS_STORAGE_CLASS]
7options = {
8 Http::BOS_STORAGE_CLASS => 'COLD'
9}
10# Convert infrequent access storage to cold storage
11client.copy_object(bucket_name, object_name, bucket_name, object_name, options)
12puts client.get_object_meta_data(bucket_name, object_name)[Http::BOS_STORAGE_CLASS]
