Cost optimization
When you use OSS, you can significantly reduce costs by planning storage classes around how your data is actually used and by combining subscription and pay-as-you-go billing.
Precautions
The unit prices in the following examples are taken from the detailed OSS pricing published on the Alibaba Cloud official website on July 30, 2024. Unit prices for individual billable items may differ depending on the date on which the prices were collected. Always refer to the data published on the Object Storage Service pricing page.
The following examples cover only common storage and data request scenarios. If you use other OSS features, additional billable items may apply. For more information, see Billable items.
Check whether bucket capacity growth matches your expectations
When you store data in a bucket, storage fees are charged based on the storage capacity and the storage class of the data. To understand how your buckets are used, use CloudLens to track key metrics such as bucket capacity and reveal daily, weekly, and monthly access trends for your datasets.
For a more granular view of your costs, periodically query account-level OSS usage and export the usage details as a CSV file. The file lists the storage capacity of each bucket in the current account, which lets you judge whether capacity growth is expected. For detailed steps, see Query resource usage of an Alibaba Cloud account.
If capacity grows unexpectedly, set the ACL to private or configure a bucket policy to prevent other users from performing unauthorized operations on your OSS resources. Such operations include uploading large numbers of unwanted objects, which causes capacity to spike, and maliciously accessing objects, which generates high outbound traffic over Internet fees. For more information, see Reduce the risks of unauthorized access caused by AccessKey pair leaks.
Reduce outbound traffic over Internet and data retrieval fees for the bucket owner
Suppose a bucket owner authorizes other users to access data in the bucket over the Internet and wants the requesters to pay for outbound traffic over Internet and for the capacity fees incurred when Infrequent Access data is read. In this case, the bucket owner can enable pay-by-requester mode. For detailed steps, see Pay-by-requester.
Downstream traffic plans cannot offset the outbound traffic over Internet fees that requesters incur when they download data from OSS to a client over the Internet after pay-by-requester mode is enabled. In this mode, Internet traffic fees are charged based on actual usage only.
Identify and clean up unused objects
OSS cannot judge the business value of an object, so it cannot automatically determine whether an object is still useful. When a large number of objects accumulate in a bucket, use the following methods to assess how the objects are used and then clean up the ones you no longer need:
Use the Inventory feature to periodically export metadata for all objects in the bucket, including object name, size, storage class, last modified time, and last access time. Analyze the metadata to determine how each object is used. For detailed steps, see Bucket inventory.
Use Object Tagging to classify objects by purpose, such as backup, archive, temporary, or active, so that you can filter and manage them in batches later. For detailed steps, see Tag objects.
Enable Logging and use CloudLens for OSS to analyze how often objects are accessed and identify cold data that has not been accessed for a long time. For detailed steps, see Log shipping and Use CloudLens for OSS.
After you determine the value of each object, configure lifecycle rules to automatically clean up or transition low-value objects. For example, delete unused objects, or convert cold data to a lower-cost storage class to reduce storage fees. For detailed steps, see Instructions for lifecycle rules.
Whether an object is ultimately retained is a decision that you must make based on your business requirements.
Configure lifecycle rules
To manage and reduce your OSS costs more effectively, we recommend that you make full use of lifecycle management policies to maximize cost efficiency.
Transition storage classes based on access frequency and response time requirements
When a dataset is accessed less often, or when real-time access to the data is no longer required, configure appropriate lifecycle rules to automatically move the data to a lower-cost storage class without affecting access performance.
|
Selection reference |
Scenario |
Data access frequency |
|
Standard |
Hot data that is accessed frequently and read in real time. |
More than once per month per object |
|
Infrequent Access |
Warm data that is accessed less frequently but must still be read in real time. |
Less than once per month per object |
|
Archive |
Cold data that must be retained for a long time and is rarely accessed, but must be retrieved quickly when it is needed. The restore time is about 1 minute. |
Less than once per 90 days per object |
If you set the storage class to Archive and do not enable real-time access of Archive objects, you cannot access the data in real time and must restore the objects before you read them.
Based on the characteristics and access frequency of your data, you can filter specific objects by prefix or tag and configure lifecycle rules for them. Cold data that is rarely accessed is automatically transitioned to lower-cost Archive storage, whereas frequently accessed hot data remains in Standard storage for faster reads. This approach optimizes storage costs and improves data access efficiency.
The following examples show how storage costs are calculated and how to choose the most suitable storage class for your requirements.
Example
User A stores 100 TB of business data (10 million objects) under the dir directory of a bucket in the China (Hangzhou) region, using the Standard (ZRS) storage class, mainly for the company's daily operations. In the early stage of the business, the data was accessed very frequently. As the business evolved, access patterns changed. To optimize costs, User A wants to adjust the storage class of the business data at each business stage.
Early stage: all data is accessed frequently
In the early stage, the 100 TB of data is accessed an average of 5 times per month. Because access speed is critical at this point, Archive storage, which does not support real-time reads, is not suitable. User A is deciding whether to stay on Standard storage or to configure lifecycle rules that transition part of the data to Infrequent Access.
Standard storage costs 0.15 CNY/GB/month. GET requests are free within 20 million requests and cost 0.01 CNY per 10,000 requests beyond that. No data retrieval fees apply.
Infrequent Access costs 0.10 CNY/GB/month. GET requests cost 0.1 CNY per 10,000 requests per month per region, and the data retrieval fee is 0.0325 CNY/GB.
Cost analysis:
|
Storage class |
Total data |
Storage fee (CNY/month) |
API request fee (CNY/month) |
Data retrieval capacity fee (CNY/month) |
Total fee (CNY/month) |
|
Standard ZRS |
100 TB |
15360 |
30 |
0 |
15390 |
|
Infrequent Access ZRS |
100 TB |
10240 |
500 |
16640 |
27380 |
As the table shows, when data is accessed frequently, Standard storage wins on both cost and access speed: it keeps access efficient and avoids the extra read fees that Infrequent Access incurs. Standard storage is therefore the best choice for the business data at this stage.
Growth stage: part of the data is accessed less frequently
As the business expands, the total volume of stored data remains 100 TB, but access patterns change: 90% of the data (90 TB) is accessed only once per month, while the remaining 10% (10 TB) is still accessed frequently. To adapt to this change and keep costs under control, User A considers two strategies:
Stay on Standard storage: Keep the current configuration and continue to use the Standard storage class.
Apply lifecycle rules: Transition the data that is accessed less frequently to the more economical Infrequent Access class to reduce storage costs.
Cost analysis:
-
The cost of keeping all business data in Standard storage is calculated as follows:
Storage class
Total data
Storage fee (CNY/month)
API request fee (CNY/month)
Data retrieval capacity fee (CNY/month)
Total fee (CNY/month)
Standard ZRS
100 TB
15360
30
0
15390
-
Use a lifecycle rule to filter, by prefix or tag, the 90 TB of business data that is accessed an average of once per month. Configure the rule so that this data is automatically transitioned from Standard to Infrequent Access within 30 days after the last access. The remaining 10 TB of business data stays in Standard storage.
Standard storage: The storage fee is 0.15 CNY/GB/month. GET requests stay within 20 million requests, so no API request fee applies, and no data retrieval fee applies.
Infrequent Access: The storage fee is 0.10 CNY/GB/month. GET requests cost 0.1 CNY per 10,000 requests per month per region, and the data retrieval fee is 0.0325 CNY/GB.
Storage class
Total data
Storage fee (CNY/month)
API request fee (CNY/month)
Data retrieval capacity fee (CNY/month)
Total fee (CNY/month)
Standard ZRS
10 TB
1536
0
0
1536
Infrequent Access ZRS
90 TB
9216
90
2995.2
12301.2
With lifecycle rules in place, the combined cost of the two storage classes is 13837.2 CNY, about 10.1% lower than using Standard storage alone. Now that access frequency has dropped, a lifecycle rule that transitions part of the business data to Infrequent Access is the ideal low-cost option: it keeps access fast while effectively controlling costs.
Recommended action:
User A can configure a lifecycle rule that automatically transitions objects matching a specified prefix from Standard to Infrequent Access within 30 days after the last access, striking a balance between cost optimization and data access speed. For detailed steps, see Lifecycle rules based on last access time.
Mature stage: cold data is retained long term
As the business matures, User A finds that some business data is used far less: it is accessed an average of once per quarter. User A confirms that access demand for this data will remain extremely low over the next few months and accepts a short restore time before the data can be read. User A therefore considers a lifecycle rule that transitions this data from Infrequent Access to Archive.
Use a lifecycle rule to filter, by prefix or tag, the 90 TB of business data that is accessed an average of once per quarter. Within 30 days after the last access, this data is automatically transitioned from Infrequent Access to Archive. The remaining 10 TB of business data stays in Standard storage because it is accessed frequently.
Standard storage: The storage fee is 0.15 CNY/GB/month. GET requests stay within 20 million requests, so no API request fee applies, and no data retrieval fee applies.
Archive: The storage fee is 0.033 CNY/GB/month. GET requests cost 0.1 CNY per 10,000 requests per month per region, and the data retrieval capacity fee is 0.06 CNY/GB.
|
Storage class |
Total data |
Storage fee (CNY/month) |
API request fee (CNY/month) |
Data retrieval capacity fee (CNY/month) |
Total fee (CNY/month) |
|
Standard ZRS |
10 TB |
1536 |
0 |
0 |
1536 |
|
Archive ZRS |
90 TB |
3041.3 |
30 |
1843 |
4914.3 |
As the table shows, a lifecycle rule that further transitions this business data from Infrequent Access to Archive brings the combined cost of the two storage classes to 6450.3 CNY, another 53.4% lower than transitioning to Infrequent Access alone, for a much more significant cost saving.
Recommended action
If your access patterns are known and stable, specify all objects that match a prefix in the rule, and change the configuration so that objects are automatically transitioned from Standard to Infrequent Access within 30 days after the last access, and from Infrequent Access to Archive 60 days after the last access. Objects then move from Standard to Infrequent Access 30 days after the last access and to Archive 30 days later, which achieves the lowest storage cost. For detailed steps, see Lifecycle rules based on last access time.
Delete previous versions of objects
After versioning is enabled for a bucket, operations that overwrite or delete data are preserved as previous versions. When a large number of previous versions accumulate in the bucket, use lifecycle rules to delete the ones you no longer need and reduce storage costs.
Recommended action
We recommend that you configure a lifecycle rule to automatically delete objects once they reach a specified age in days.
In the preceding configuration example, OSS automatically deletes previous versions of objects that were last modified more than 200 days ago. For detailed steps, see Lifecycle rules based on last modification time.
Delete expired parts to reduce storage costs
If you do not call the CompleteMultipartUpload operation to combine the parts after a multipart upload, the parts remain in the bucket indefinitely, consume storage capacity, and incur storage fees.
Recommended action
We recommend that you configure a lifecycle rule to automatically delete parts when they reach a specified age in days or on a specified date.
In the preceding configuration example, OSS automatically deletes parts that were generated more than 2 days ago. For detailed steps, see Lifecycle rules based on last modification time.
Purchase resource plans
Before you purchase resource plans
Based on the preceding examples, User A stores 100 TB of data (10 million objects) in an OSS bucket using the Infrequent Access class. The data is accessed an average of once per month and must be available in real time.
The storage cost before any resource plan is purchased is calculated as follows:
|
Storage class |
Total data |
Storage fee (0.10 CNY/month) |
Outbound traffic over Internet fee (08:00-24:00 (peak hours): 0.50 CNY/GB) |
Data retrieval capacity fee (0.0325 CNY/GB) |
Total fee |
|
Infrequent Access ZRS |
100 TB |
10240 |
51200 |
3328 |
64768 |
After you purchase resource plans
Consider purchasing an Infrequent Access ZRS storage plan and a downstream traffic plan to offset the corresponding billable items. Billable items that resource plans cannot offset are charged on a pay-as-you-go basis.
-
Offset Infrequent Access ZRS capacity fees with an Infrequent Access ZRS storage plan
Purchase a 100 TB Infrequent Access ZRS storage plan with a subscription period of one month to offset the Infrequent Access ZRS storage capacity fee.
-
Offset outbound traffic over Internet fees with a downstream traffic plan
Purchase a 100 TB downstream traffic plan to offset the outbound traffic over Internet fees generated when different proportions of the data are accessed over the Internet.
Infrequent Access ZRS data retrieval capacity is billed on a pay-as-you-go basis only and cannot be offset by a resource plan.
After the resource plans are applied, the costs are summarized as follows:
|
Storage class |
Total data |
Infrequent Access ZRS storage plan fee |
Downstream traffic plan fee |
Data retrieval capacity fee (0.0325 CNY/GB) |
Total fee |
|
Infrequent Access ZRS |
100 TB |
9216 |
43008 |
3328 |
55552 |
As the comparison shows, combining resource plans with pay-as-you-go billing saves 14% compared with pay-as-you-go billing alone.
Recommended action
Purchase an Infrequent Access ZRS storage plan and a downstream traffic plan. For detailed steps, see Purchase OSS resource plans.