Amazon S3 (Simple Storage Service) is the first service launched by AWS. In its 15 years of existence, S3 has changed how businesses worldwide store and access data, effectively kicking off cloud computing and revolutionizing AWS S3 storage costs.
Like all cloud services, S3 can be expensive, especially if you are not using it efficiently and considering the cost of S3 storage.
Let’s take a look at seven ways you can reduce your AWS S3 costs – today.
1. Choose the Right Storage Class: Optimizing AWS S3 Storage Costs
Your Amazon S3 storage costs will depend on:
The size of the data you’re storing
The number of requests used to access your data
Request type (e.g. PUT, GET, COPY, etc)
The region where you store your data
Data transfer and retrieval fees
But by far the biggest factor influencing your S3 bill is the storage class you assign to your S3 objects, impacting your AWS S3 storage costs. Make sure you choose (or transfer to) a storage class that’s right for your use case:
Standard – best suited for objects you need to access frequently. This storage class provides a higher cost per GB but comes with high data availability and reliability.
Standard Intelligent-Tiering – a great choice for data with unknown, changing, or unpredictable access patterns.
Standard Infrequent Access (IA) – ideal for data you need to access less frequently but rapidly. Offers the same upsides as S3 Standard, but at a lower price per GB stored and retrieved.
Standard One-Zone Infrequent Access – about 20% cheaper than Standard IA as it stores data in a single Availability Zone.
Glacier Instant Retrieval – ideal if you have a small number of long-lived, rarely accessed objects that are large in volume.
Glacier Flexible Retrieval – ideal for long-term data you don’t need real-time access to.
Glacier Deep Archive – the cheapest storage class on S3 built for long-term data storage (7-10 years).
Outposts – ideal if you need to keep data close to on-premises applications.
2. Set Up Billing Alarms
Once you have the right storage class for your use case figured out, considering the cost of S3 storage, the next step is creating a billing alarm to avoid a surprisingly high S3 bill.
You can do that through the CloudWatch console by choosing 'Billing' and 'Total Estimated Charge' as your metric, effectively monitoring your Amazon S3 costs. From there, you can define a dollar value that triggers your alarm and sends a notification when your usage exceeds that threshold.
For a more detailed breakdown of your AWS S3 costs, try Finout. This FinOps-first cloud cost management tool will let you dive deep into your daily, weekly or monthly AWS spending.
3. Delete Unused Objects
In S3, each object version contributes to your storage AWS S3 costs. But how do you find unused objects within a bucket?
One way to reduce S3 costs to do this is by using the AWS CLI to list all objects in a specified S3 bucket. Simply run aws s3 ls -summarize -human-readable -recursive s3://your-bucket-name
Then, identify the unused objects by looking at the LastModified column. If empty, delete the object by running aws s3 rm s3://your-bucket-name/object-name
You can also delete multiple (or all) objects within a bucket as well as entire buckets. Just keep in mind that S3 won't be able to restore any data after the fact.
4. Automatically Manage Objects with Amazon S3 Lifecycle
With Amazon S3 Lifecycle, you can automate the transition of objects to less expensive storage classes at set intervals and specify when objects should be deleted from your Amazon S3 bucket.
For example, if you know that certain objects are infrequently accessed, you might want to transition them to the S3 Standard-IA storage class. Or, you can set up S3 to automatically delete expired objects on your behalf.
Setting up an S3 Lifecycle rule
5. Cut Down On Cross-Regional Data Transfer
If you frequently transfer data between S3 buckets in different regions, you can use the cross-region replication feature to mirror your S3 bucket in a different region.
This will improve performance and save you money on data transfer and Amazon S3 storage costs.
For example, if you are transferring 20 GB from a bucket in US-west-2 to an EC2 instance in US-east-1, you would be charged $0.20.
However, if you first downloaded the data to a mirror S3 bucket in US-east-1, you would only pay $0.02 for transfer and $0.03 for storage over the course of a month, which would be significantly less expensive.
6. Compress Your Data Before Storing It
S3 charges you based on the amount of data you store and the amount of data you transfer out of the service.
By compressing your data before you send it to S3, you can reduce the amount of storage and data transfer charges you pay. Your best bet is to use fast compression such as LZ4 to improve performance while reducing storage requirements and AWS S3 storage costs.
7. Partition Your Data Before Querying It
As mentioned at the beginning of this article, the number of requests used to access your data as well as their type will affect your AWS S3 costs.
To minimize them, consider partitioning your data. Partitioning improves query performance because it limits the amount of data that has to be scanned. For example, if a table is partitioned by date, a query that accesses only a single day of data can scan only the files in that day’s partition, rather than the entire table.
Ready To Drive Down Your AWS S3 Costs?
Amazon S3 has drastically changed the way businesses worldwide store, transfer, and manage data.
With these seven tips, you'll be on the right path to reducing your S3 spending while getting the best out of cloud computing.