Amazon S3 is a highly scalable and durable cloud storage service that provides businesses with an efficient way to store and retrieve data.
Over time, data aggregates within the S3 buckets which ultimately can drive up costs. S3 has a feature called lifecycle policies that allows for files to be transitioned into different tiers of storage or expired completely. First. let’s go over the different storage classes of S3 where files can be transitioned to:
- NOTE: For up to date pricing (with region), please check in AWS’s S3 pricing chart
- S3 Standard:
- S3 Standard storage is the default storage class for S3. This storage class is good for holding frequently accessed objects. It provides low latency and high throughput performance with 99.999999999% durability and 99.99% availability. It is $0.023 per GB per month for the first 50 TB, with reduced pricing for higher usage.
- S3 Intelligent Tiering:
- S3 Intelligent storage is designed for data with unknown or changing access patterns and will use machine learning to automatically move data from one tier to another based on access patterns. It is $0.0025 per GB per month for monitoring and automation fees, plus separate fees for storage and data access based on the access tier.
- S3 Infrequent Access (IA):
- S3 IA storage is used for files that are infrequently accessed and require rapid access when needed. This tier has the same durability as S3 Standard storage but has lower availability and higher latency. It is $0.0125 per GB per month for the first 50 TB, with reduced pricing for higher usage.
- S3 One Zone Infrequent Access (S3 One Zone-IA):
- S3 One Zone-IA is designed to infrequently accessed data that also only lives within one availability zone. This storage class has the same durability but lacks resilience when it comes to database failures. It is $0.01 per GB per month for the first 50 TB, with reduced pricing for higher usage.
- S3 Glacier:
- S3 Glacier is used for data archives that requires regulatory compliance and can be retrieved within minutes to hours. This is best for archival regulatory documents. It is $0.004 per GB per month for standard retrievals, with additional fees for expedited retrievals and data transfers.
- S3 Glacier Deep Archive:
- S3 Glacier Deep Archive is designed for long-term data archiving that is rarely accessed and can be retrieved within hours to days. It is $0.00099 per GB per month for standard retrievals, with additional fees for bulk retrievals and data transfers.
Now that we know the different tiers of storage for S3, lets look into how to optimize S3 costs using lifecycle policies:
- To create a lifecycle policy, navigate to the S3 bucket that you want to configure and click on the “Management” tab.
- From there, select “Lifecycle” and then click on the “Add lifecycle rule” button.
- Next, you will need to define the criteria for the lifecycle rule.
- You can choose to transition objects to a different storage class or delete them altogether based on the age of the object or other criteria such as the object’s size, tags, or version.
For example, you may want to transition objects that have not been accessed for more than 30 days to the S3 Infrequent Access (IA) storage class, which is a lower-cost storage class designed for infrequently accessed data. To do this, you would create a lifecycle rule with the following settings:
- Transition to the S3 Infrequent Access (IA) storage class after 30 days of creation.
- Permanently delete objects that have not been accessed for more than 90 days.
By using lifecycle policies to automate the process of transitioning objects to different storage classes or deleting them altogether based on their age or other criteria, you can optimize your S3 costs and ensure that you are only paying for the storage that you actually need.
If interested in more about S3, check out this article on everything you need to know about S3 encryption!