A high-performance, concurrent CLI tool for cleaning up stale S3 objects.
S3 Sweeper is a DevOps tool written in Go that scans AWS S3 buckets for files older than a specific age and optionally deletes them. It leverages Go Concurrency patterns (Worker Pools) to process thousands of objects in parallel, making it significantly faster than sequential scripts.
- Concurrent Scanning: Uses a configurable worker pool to process objects in parallel.
- Safety First: Default
Dry-Runmode prevents accidental deletions. - AWS SDK v2: Built on the latest AWS standards.
- Dockerized: Ready to run in CI/CD pipelines or Kubernetes.
The tool implements a Producer-Consumer pattern:
- Producer: Iterates over S3 pages and pushes object metadata to a
Jobchannel. - Worker Pool:
Ngoroutines concurrently pull jobs, check age criteria, and delete if necessary. - Collector: Aggregates statistics (space saved, files deleted) for a final report.
docker run --rm \
-e AWS_ACCESS_KEY_ID=... \
-e AWS_SECRET_ACCESS_KEY=... \
-e AWS_REGION=us-east-1 \
ghcr.io/yourusername/s3-sweeper:latest scan --bucket my-logs --days 30