Your CI pipeline pushes container images to ECR every commit — thousands of untagged images are inflating storage costs. What cleans them up automatically?
A.ECR lifecycle policy that expires untagged images older than N days
Correct — declarative rule, managed evaluation, zero code.
B.A scheduled Lambda deleting old images
Custom Lambda reinvents a built-in feature.
C.Recreate the repository weekly
Repo recreation loses tags history and breaks deployment references.
D.Enable image immutability
Immutability prevents tag overwrite — opposite of cleanup.
Why this answer
ECR lifecycle policies expire images by rule — e.g., untagged older than 14 days, or keep only the last 30 images — the managed answer for registry hygiene.
Correct answer: A · Last reviewed 2026-11-01
Official AWS references
Practice this interactively
Answer without seeing the solution first in the CI/CD & Observability practice session.
Practice CI/CD & Observability