Interview Prep/AWS/ECS, EKS, Lambda and ECR

An ECR repo grows to 2 TB of images. How do you control it?

IntermediateScenarioECS, EKS, Lambda and ECR
Answer

Situation read → Lifecycle policies expire old images.

What I'd do →

  1. Create a lifecycle policy keeping the last 20 tagged release-* and expiring untagged after 7 days
  2. aws ecr put-lifecycle-policy --repository-name app --lifecycle-policy-text file://policy.json
  3. Use --image-tag-mutability IMMUTABLE for release tags
  4. Enable image scanning on push

Why → Storage is billed per GB-month, and old layers accumulate quietly.

Interview tip → Preview with the dry-run lifecycle preview.

aws All AWS questions Roadmap: EKS, ECS & serverless on AWS

More on ECS, EKS, Lambda and ECR