Thanos Sidecar and Object Storage
What you'll learn: How to deploy Thanos sidecars alongside Prometheus to automatically upload metric blocks to object storage for long-term, cost-effective retention.
The Long-Term Retention Challenge
Prometheus stores metrics locally, but local disk space is limited and expensive at scale. Thanos Sidecar solves this by continuously uploading Prometheus data blocks to cloud object storage (like S3, GCS, or Azure Blob), enabling virtually unlimited retention at a fraction of the cost.
How the Sidecar Works
The Thanos Sidecar runs as a companion container in the same pod as your Prometheus instance. Think of it as a diligent archivist that watches Prometheus write data blocks every two hours, then immediately ships those blocks to your configured object storage bucket.
The sidecar operates in two modes:
- Upload mode – Monitors Prometheus's TSDB directory and uploads completed blocks
- Query mode – Exposes an API that Thanos Query can use to retrieve historical data from object storage
Key Configuration Elements
You configure the sidecar with:
- Object storage credentials (bucket name, access keys, region)
- Prometheus URL for metadata queries
- TSDB path to monitor for new blocks
- Upload frequency and retention policies
The sidecar doesn't interfere with Prometheus's operation—it reads completed, immutable blocks that Prometheus has already written to disk. Once uploaded, these blocks can be safely deleted from local storage, freeing up space while preserving queryability through Thanos Query.
Why This Matters
This architecture decouples storage from compute. Your Prometheus instances stay lean with short local retention (days), while Thanos provides seamless access to months or years of historical data from cheap object storage—all through a unified query interface.
Key Takeaway: Thanos Sidecar bridges Prometheus and object storage, automatically archiving metric blocks for cost-effective, long-term retention without impacting Prometheus performance.