The Amazon S3 charges on my AWS bill are unexpectedly high. What can I do to reduce my Amazon S3 costs?
Last updated: 2020-05-28
The charges for Amazon Simple Storage Service (Amazon S3) usage on my AWS bill are higher than I expect. What can I do to reduce my Amazon S3 costs?
Amazon S3 charges are based on storage, requests and data retrievals, data transfer (including S3 Transfer Acceleration usage), and data management. To identify where you can cut down on your Amazon S3 charges, it's a best practice to first understand your current billing and usage for Amazon S3 and the ways that you can incur cost.
After you understand how you're charged on Amazon S3, you can try the following ways to review and potentially reduce your costs:
- Clean up incomplete multipart uploads
- Delete previous versions of objects that you don't need
- Review your storage-class transition costs
- Review your data retrieval costs
- Track the requests made to your bucket
- Check for changes in the size of your bucket
- Review the cost of individual buckets
- Understand how your usage relates to your charges
Clean up incomplete multipart uploads
After you initiate a multipart upload, Amazon S3 retains all the uploaded parts of the file until you either complete or abort the multipart upload. If you don't complete the multipart upload successfully, then Amazon S3 continues to store the uploaded parts by default. This means that you're charged for the storage of the uploaded parts.
If you use the AWS Command Line Interface (AWS CLI) to abort the multipart upload (abort-multipart-upload), then the operation deletes the uploaded parts of the incomplete multipart upload. However, if you use other tools that use Amazon S3's multipart upload API, then incomplete multipart uploads might leave behind the uploaded parts.
To avoid storage charges for uploaded parts left behind from an incomplete multipart upload, you can create a lifecycle policy that cleans up incomplete multipart uploads after a certain number of days.
Delete previous versions of objects that you don't need
Warning: Be careful to delete only objects or object versions that you don't need. Amazon S3 can't restore any data that you delete from your buckets.
If you have versioning enabled on your bucket, then each object can have multiple versions. Each object version contributes to your storage costs.
Note: In a version-enabled bucket, you must specify the object version ID to permanently delete an object version. If you run a simple delete request on an object in a version-enabled bucket, then Amazon S3 adds a delete marker to the object. The delete marker becomes the current version of the object, and the actual object becomes the previous version. However, the object and its versions are not actually erased.
You can also use a lifecycle rule to manage the current and non-current versions of your objects. However, you must carefully review the parameters for your lifecycle rule, because permanent deletions in Amazon S3 are irreversible.
Review your storage-class transition costs
It's common to transition objects into other storage classes to reduce your ongoing storage costs. However, it's also important to know that there can be costs associated with transitioning objects from one storage class to another.
For example, you're charged $0.01 for every 1,000 lifecycle transition requests for objects transitioning from the Amazon S3 Standard storage class to the Amazon S3 Standard-Infrequent Access (S3 Standard-IA) storage class. You're charged $0.05 for every 1,000 lifecycle transition requests for objects transitioning from any storage class to the Amazon Simple Storage Service Glacier (Amazon S3 Glacier) storage class. For more information and pricing details, see Amazon S3 pricing.
If you set up a lifecycle configuration rule that transitions an entire bucket with millions of objects to another storage class, then you can expect an increase in Amazon S3 charges. To determine if an increase in your charges is because of a lifecycle rule, you can review your AWS CloudTrail event history or Amazon S3 server access logs for PutBucketLifecycleConfiguration calls to identify when the rule was applied.
Review your data retrieval costs
Objects stored in the S3 Standard-IA, S3 One Zone-IA, Amazon S3 Glacier, or Amazon S3 Glacier Deep Archive storage classes have costs associated with data retrievals.
For example, if you're retrieving 15 million objects from the Amazon S3 Glacier storage class that altogether amount to 100 TB of data, then your total cost of retrieval is based on the retrieval option that you choose:
- The retrieval request is 15,000,000 / 1000 * $0.025 = $375.
- The retrieval is 100,000 * $0.0025 = $250.
- The total cost is $625.
- The retrieval request is 15,000,000 / 1000 * $0.05 = $750.
- The retrieval is 100,000 * $0.01 = $1,000.
- The total cost is $1750.
- The retrieval request is 15,000,000 / 1000 * $10 = $150,000.
- The retrieval is 100,000 * $0.03 = $3,000.
- The total cost is $153,000.
Track the requests made to your bucket
You can monitor requests to your bucket in one or more of the following ways:
- You can enable server access logging. For more information on how to review access logs, see Amazon S3 Server Access Log Format.
- You can enable object-level logging using AWS CloudTrail.
- You can enable Amazon CloudWatch metrics for Amazon S3 requests. Metrics such as AllRequests and BytesDownloaded can help you monitor the requests made to your bucket.
After you understand the requests that are made to your bucket, you can take measures to reduce your costs from requests. For example, you can prevent unauthorized access or limit public access to your bucket using bucket policies or AWS Identity and Access Management (IAM) policies. Or, to reduce your costs from data transfer OUT charges, you can access your bucket using an Amazon Elastic Compute Cloud (Amazon EC2) instance that's in an Amazon Virtual Private Cloud (Amazon VPC) within the same AWS Region as your bucket.
Check for changes in the size of your bucket
To isolate storage costs, you can compare the current size of your bucket and with the size of your bucket from a previous month. You can review your bucket's storage size in the Amazon S3 console:
- View your bucket from the Amazon S3 console.
- Choose the Management tab.
- Choose Metrics.
You can also review your bucket's storage size using the AWS CLI or the CloudWatch console.
Review the cost of individual buckets
To identify if one particular bucket is resulting in higher costs, you can activate cost allocation tags on your buckets, and then review your buckets using the AWS Cost Explorer.
Understand how your usage relates to your charges
Your usage report records storage usage in byte-hours, and your billing report records storage usage in GB-months. So to understand how your storage usage relates to your storage charges, you must convert byte-hours into GB-months. For an example of this conversion, see Converting Usage Byte-Hours to Billed GB-Months.
You can download your Amazon S3 usage report from the Billing & Cost Management Dashboard.