- Newest
- Most votes
- Most comments
The most flexible option for your use case is to transition the objects to S3 Intelligent-Tiering: https://docs.aws.amazon.com/AmazonS3/latest/userguide/intelligent-tiering-overview.html. It will cause objects larger than 128 kiB to be monitored automatically by S3. When S3 detects that an object in the initial Frequent Access Tier hasn't been accessed for 30 consecutive days, it will automatically transition it to the Infrequent Access Tier within the Intelligent-Tiering class, with the same per-gigabyte cost as Standard-IA. After the object has continued not to be accessed even once for another 60 days, for a total of 90 days of no activity, it will be automatically transitioned to the Archive Instant Access Tier, with a storage cost mathing that of Glacier Instant Retrieval.
If any of the objects tiered down to the Infrequent Access or Archive Instant Access Tiers is accessed, such as in the case of a decade-old object that suddenly starts to get used again, it will move automatically move up to the Frequent Access Tier and start to get evaluated again to detect if the active use ends and it's time to transition it to the less expensive storage tiers again.
There's a one-time cost per object to transition it from the Standard class to Intelligent-Tiering (or to any other storage class, for that matter), unless you place your objects initially in that class, but there are no additional retrieval costs for these three basic online tiers in Intelligent-Tiering. However, the per-object monitoring that S3 does for you does come with a small per-object cost: https://aws.amazon.com/s3/pricing/. You may want to transition only objects large enough for the storage savings to offset the monitoring costs. The exact break-even point depends on your discount level and how many of the monitored objects end up getting accessed, but it's often around ~160,000 bytes, slightly above the minimum of 128 kiB (131,072 bytes) below which no tiering is done and monitoring isn't charged.
Yes, there is a cost associated with moving your older files to Glacier Instant Retrieval using lifecycle rules. When you transition objects from S3 Standard or S3 Infrequent Access (IA) to Glacier Instant Retrieval, you incur a transition cost. This cost is typically charged per 1,000 requests.
Regarding moving files back to Glacier after retrieval, it's important to note that Glacier Instant Retrieval is actually a storage class within S3, not a separate Glacier service. Once an object is in Glacier Instant Retrieval, it remains there unless you explicitly move it or apply a new lifecycle rule. There isn't an automatic process to move it back based on lack of access.
As for exempting frequently accessed files from lifecycle rules, S3 lifecycle rules don't currently support exemptions based on last access time. Lifecycle rules are typically based on creation date or last modified date. If you have files that are accessed weekly, even if they're over 10 years old, you might want to consider keeping them in a more readily accessible storage class like S3 Standard or S3 Infrequent Access.
It's worth noting that while Glacier Instant Retrieval offers lower storage costs, it has higher retrieval costs compared to S3 Standard or S3-IA. For files accessed weekly, the increased retrieval costs could potentially outweigh the storage cost savings.
When deciding on a storage strategy, it's crucial to consider your specific access patterns, retrieval needs, and overall costs. You may want to use S3 Storage Lens or other analytics tools to understand your data access patterns better before implementing lifecycle rules.
Sources
What is the best way to delete large data from S3 ? | AWS re:Post
Amazon S3 Glacier - AWS Prescriptive Guidance
Amazon S3 Glacier API Pricing | Amazon Web Services
The AI generated answer is pretty good actually, but I would add a couple of points.
First, if you have specific files which are frequently accessed and others which are not, you may want to just use folders or tags to identify which files need to be available for frequent access. Any files in a certain folder or having a certain tag would be ignored by the lifecycle rule, so the files will stay available. Once they are no longer needed for frequent access, just move the file or remove the tag, and the lifecycle rules will move it to glacier storage.
The problem with archiving based on the last accessed date is that S3 doesn't actually track that information by default. It must be retrieved from cloudwatch logs. It's definitely possible to do this, but it requires a fair amount of setup.
If you really want a fully automated solution for this, you will need to monitor cloudwatch logs to see when a file was last accessed, then use that to decide which files get archived. It would probably involve running a lambda function to search the logs for access events, then apply some sort of tags or metadata to the files which can then be used with lifecycle rules. Personally I wouldn't bother with that unless you have really complex requirements.
Here's an article which describes one method for doing this, there are probably a few other approaches that would work as well. https://aws.amazon.com/blogs/architecture/expiring-amazon-s3-objects-based-on-last-accessed-date-to-decrease-costs/
Relevant content
- asked 2 months ago
- asked 8 months ago
- AWS OFFICIALUpdated 4 months ago
- AWS OFFICIALUpdated 2 months ago
- AWS OFFICIALUpdated 2 months ago

Honestly this is probably the best solution for 90% of people. The only limitations are you can't speed up the default time frames for moving between tiers, but the defaults are pretty sensible in my opinion.
Agreed, @yet another. Professionally, what I find the most inconvenient thing about Intelligent-Tiering (INT) is that if you already have objects in Standard-IA (SIA) or, probably statistically far less frequently, in Glacier IR (GIR), you can't transition them directly to the corresponding tier in INT. With large amounts of data typically in SIA, it can be costly to have to pay for the transitioning from SIA to INT, followed by nearly double the storage cost for the first 30 days, and then another 60 days until the ultimate savings from the tiering to Archive Instant Access start.