This repository now has a small storage-tiering workflow for long-lived S3 data:
- Terraform lifecycle rules for the backup bucket
- An access-analysis script that scores objects by recency and request volume
- Retrieval commands for archived objects
- A JSON report that can be used for cost review
The backup bucket is configured to transition through cheaper tiers over time:
STANDARD_IAafter 30 daysGLACIER_IRafter 90 daysDEEP_ARCHIVEafter 180 days- noncurrent versions are expired after 365 days
See infrastructure/terraform/s3-tiering.tf and the existing bucket definitions in infrastructure/terraform/s3-buckets.tf.
Use infrastructure/scripts/analyze-access.sh to turn an access inventory into a recommendation report.
The script expects JSON like:
[
{
"key": "backups/2026-06-01.sql.gz",
"bucket": "gistpin-backups",
"storage_class": "STANDARD",
"size_bytes": 12345,
"last_accessed_days": 42,
"request_count_30d": 8
}
]Run it with a file or by piping JSON on stdin:
bash infrastructure/scripts/analyze-access.sh \
--input /tmp/s3-access-inventory.json \
--bucket gistpin-backupsThe script writes a report to infrastructure/ci/reports/storage-tiering/ by default. The report includes:
- object counts per tier
- normalized storage-cost estimates
- objects that should move to a cheaper class
- restore commands for archived objects
- a lifecycle recommendation block for the backup bucket
For objects recommended for archive storage, the report includes restore commands using aws s3api restore-object.
Example:
aws s3api restore-object \
--bucket gistpin-backups \
--key backups/2026-06-01.sql.gz \
--restore-request '{"Days":7,"GlacierJobParameters":{"Tier":"Standard"}}'Treat the generated report as an operational cost review artifact:
- Run the access analysis on the latest inventory export.
- Review objects recommended for tier changes.
- Apply the lifecycle rules or restore commands as needed.
- Re-run the report to confirm the savings trend.