Difficulty: Easy
Description
These repositories hold untagged images you keep paying to store. A lifecycle policy that expires them 30 days after push removes them automatically.
Selection Criteria
The repository contains at least one untagged image.
The repository has no lifecycle rule that expires untagged images within 30 days. A rule counts only when it uses
tagStatus: untagged,countType: sinceImagePushed, acountNumberof 30 days or less, and theexpireaction. Rules based onimageCountMoreThan, ontagStatus: any, or on a period longer than 30 days do not count.The repository has a billed storage cost over the last 31 days.
Expected Saving
The saving is the share of the repository's billed storage cost that belongs to untagged images. We take the repository's real storage cost from the CUR over the last 31 days (net of discounts), annualize it, and multiply it by the share of image bytes held by untagged images. Data transfer is excluded from the saving because deleting images does not reduce it.
Example: a repository billing $600/year of storage, where untagged images account for 60% of the image bytes, shows a potential saving of 600 × 0.60 = $360/year.
Note:
The saving percentage is computed against the repository's total cost, which includes data transfer. A repository with significant data transfer therefore shows a lower percentage than its storage-only share.
How to apply
In the ECR console, open the repository, go to Lifecycle policy, and add a rule expiring untagged images 30 days after push. The equivalent policy JSON is:
{"rules": [{"rulePriority": 1, "description": "Expire untagged images after 30 days", "selection": {"tagStatus": "untagged", "countType": "sinceImagePushed", "countUnit": "days", "countNumber": 30}, "action": {"type": "expire"}}]}Use Lifecycle policy preview first to see which images the rule would expire.
Operational Impact
✅ No downtime — the policy only removes images that no tag points to; tagged images and running workloads are untouched.
⏳ Gradual effect — ECR evaluates lifecycle policies asynchronously, so expired images can take up to 24 hours to disappear and the storage cost decreases over the following billing days.
⚠️ Deletion is permanent — an expired image cannot be recovered. If a deployment pulls an image by digest (
repo@sha256:…) rather than by tag, make sure that image is still tagged before applying the policy.⚠️ Multi-architecture images and artifacts — the per-platform images behind a multi-arch tag, as well as signatures or attestations, can appear untagged. Check the lifecycle policy preview to confirm they are not selected.
✅ Resolution — the recommendation is marked resolved once the repository has a qualifying lifecycle rule.
