CostLensRegistry Cleanup Policy (GCP)
Registry Cleanup Policy (GCP)
CostLens flags Artifact Registry repositories with no cleanup policy, where old and untagged image versions accumulate storage.
Updated July 20261 min read
CostLens flags Artifact Registry repositories with no cleanup policy. Without one, every pushed version is kept forever — old and untagged versions accumulate storage beyond the free tier.
How it works
Repositories are enumerated
CostLens lists Artifact Registry repositories via the Artifact Registry API and checks each one's cleanup policies.
Unmanaged repos are flagged
Repos with no active cleanup policy (or only a dry-run) and storage beyond the free tier are surfaced — sized from the repo's own sizeBytes (no Monitoring needed).
Savings are estimated
Priced as the overage GB × per-GB rate × a conservative cleanup fraction.
What to do
- Add a cleanup policy that deletes untagged versions and keeps only the most recent N tagged versions (Artifact Registry → repository → Cleanup policies).
- Run it in dry-run first to preview what would be deleted, then enable it.
Severity levels
| Severity | Estimated monthly savings |
|---|---|
| critical | >$500 |
| high | $100–$500 |
| medium | $20–$100 |
| low | <$20 |
Required permissions
- Detect: Artifact Registry read (
roles/artifactregistry.reader) — see GCP Accounts.
Limitations
- Only repos whose storage exceeds the free tier are flagged.
- The savings figure is an estimate — actual savings depend on how much is genuinely old/untagged.