AWS Builder Center
A Cost-Optimized Strategy for Archiving Small Files in Amazon S3

A Cost-Optimized Strategy for Archiving Small Files in Amazon S3

Archiving millions of small files directly to Amazon S3 Glacier using Lifecycle rules can result in surprisingly high storage costs due to minimum billable object sizes, Lifecycle transition requests and Glacier metadata overhead. This article explains why bundling small files with s3tar before archiving can significantly reduce both storage and retrieval costs, making it a more cost-effective strategy for long-term data retention.

Cloud and DevOps Engineer
Amazon S3 Glacier storage classes provide a cost-effective solution for long-term data retention. Many organizations use Amazon S3 Lifecycle rules to automatically transition objects from standard storage classes into Glacier or Glacier Deep Archive.
When organizations archive TBs of objects containing billions of small files (eg. logs), the cost model becomes less efficient due to object-level storage behavior, transition requests, metadata overhead, and retrieval Complexity so, they might spend more than you’d save in storage for the entire year.

Cost Factors When Archiving Millions of Small Files

Lifecycle Transition Request Costs
When you move objects between S3 tiers via a Lifecycle Policy
  • Standard to Standard-IA: $0.01 per 1,000 objects.
  • Standard to Glacier Instant Retrieval: $0.02 per 1,000 objects.
  • Standard to Glacier Deep Archive: $0.05 per 1,000 objects.
Minimum Billable Object Size Glacier storage classes apply a minimum billable object size. S3 Glacier tiers enforce a 128 KB minimum billable size per object. If you use a standard Lifecycle rule to move a 10 KB file into Glacier, AWS bills you for 128 KB.
  • Small files consume more billed storage than their actual size.
  • Millions of tiny objects can significantly increase storage costs.
Per-Object Metadata Storage Overhead
Each archived object requires metadata for indexing and management. For every separate object archived in Glacier, AWS tacks on 40 KB of extra metadata storage fees (charged at standard rates) just to index the file.
  • More objects = more metadata overhead.
  • Millions of files increase storage inefficiency.
Retrieval Request Costs
Restoring archived data generates retrieval requests and operational overhead. If you ever need to restore your archive, standard Lifecycle objects must be retrieved one by one, racking up massive GET and retrieval API costs.
  • Millions of objects require more restore operations.
  • Recovery workflows become slower and more complex.

What Is s3tar?

s3tar is an archive optimization approach that packages many small Amazon S3 objects into TAR archives before moving them into long-term storage such as Amazon S3 Glacier.
How s3tar Helps
  1. Instead of transitioning millions of objects individually, s3tar bundles files into larger archive objects.
  1. s3tar reduces object count by packaging files together.
  1. A single archive retrieval can recover many files.
Limitations:
  1. The cumulative size of the TAR must be over 5MB
  1. The final size cannot be larger than 5TB

Procedure:

  1. Clone and Install the s3tar from the github awslabs repo:  https://github.com/awslabs/amazon-s3-tar-tool 
  1. Create a manifest file from your existing bucket objects.
 aws s3api list-objects-v2 \ --bucket <S3_BUCKET> \ --query "Contents[].[Key,Size]" \ --output text | \ awk '{print "<S3_BUCKET>,"$1","$2}' > manifest.csv 
3. Create a bundle of the files into single object
 s3tar \ --create \ --region us-west-1 \ -f s3://<S3_BUCKET>/backup.tar \ -m manifest.csv 
4. Verify and Remove the objects except the zip.
list the objects
 s3tar \ --list \ --region us-west-1 \ -f s3://<S3_BUCKET>/backup.tar 
Remove the objects execpt tar file.
 aws s3 rm s3://<S3_BUCKET> \ --recursive \ --exclude "<backup.tar>" 
5. Extracting the objects from the tar file.
 s3tar --region=us-west-1 -x -v -f s3://<S3_BACKUP>/backup.tar -C s3://<S3_BUCKET> 

Conclusion:

Amazon S3 Glacier is an excellent choice for long-term data archival, but storing millions of small objects can introduce unexpected costs through transition requests, minimum billable object sizes, metadata overhead, and retrieval complexity.
By consolidating small files into optimized archive bundles, s3tar helps reduce object count, improve storage efficiency, simplify retrieval workflows, and create a more cost-effective archival strategy.
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article