Skip to content

ECR "retain last 30 images" gives a ~1.5-day window and breaks pinned dev deployments #1101

Closed

Description

@athvin

Found while auditing detached EBS volumes for #1097. Not a cost problem — a
dev environment that cannot start, with a cause that will recur.

Symptom

rustdev's web-api deployment is 0/1 and has been since at least 99 minutes
before 2026-11-17T03:20Z. The er-migrate init container cannot pull:

Back-off pulling image ".../er-api:4728ccddb769abb5cb6d9cf755c7ebc1c62b2431"
ErrImagePull: ... failed to resolve image: ... not found

The image is gone from ECR, not unreachable.

Cause

er-api carries this lifecycle policy:

{"rules":[{"rulePriority":1,"description":"Retain the last 30 images",
  "selection":{"tagStatus":"any","countType":"imageCountMoreThan","countNumber":30},
  "action":{"type":"expire"}}]}

"Last 30 images" is a far shorter window than it sounds. Measured
2026-11-17, er-api holds 45 images and they span:

pushed tag
oldest 2026-11-09T00:50Z (untagged)
newest 2026-11-10T13:30Z a7395900dd442d72e950bd505502b8ce642dc652

That is a ~1.5 day retention window, because a busy merge day pushes dozens
of images. Any deployment pinned to a specific tag for longer than that becomes
unstartable — and rustdev's deployment is 33 days old.

Corroborating evidence the sweep happened: the ECR cost line fell from
$2.36/day (11-08) to $0.02/day (11-10 onward), which is the policy
expiring the backlog.

Why this matters beyond one namespace

Per-developer namespaces are long-lived by design, and the deploy pins an
immutable tag (correctly — a mutable latest would be worse). So the two
designs are in direct conflict: immutable pinning plus aggressive count-based
expiry means every idle dev namespace is on a ~1.5-day fuse.
A developer
returning to their namespace after a week finds it broken, with an error that
points at the registry rather than at the policy.

Options, not a recommendation

  1. Age-based rather than count-based expiry (sinceImagePushed, e.g. 30
    days) — predictable window regardless of merge volume. Costs more storage;
    ECR is $0.10/GB-month, and the whole line was under $9 at its peak.
  2. Protect tags that something currently references — a sweep that reads
    live deployments. More correct, more machinery.
  3. Re-point idle dev namespaces at a current tag on resume rather than
    retaining images for them.
  4. Accept it, and document that resuming a stale dev namespace needs a redeploy.

Option 1 looks like the best ratio here given how small the ECR line is, but
the storage-vs-reliability call is the owner's.

Immediate unblock

Re-point or redeploy rustdev's web-api at a tag that still exists — the
newest is a7395900dd442d72e950bd505502b8ce642dc652.

Activity

  1. added
    followup
    on Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    followup

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions