Check ID:
Provider: AWS
Service:
Severity: LOW
Categories:
Resource type:
ecr_repositories_lifecycle_policy_enabledProvider: AWS
Service:
ecrSeverity: LOW
Categories:
container-securityResource type:
AwsEcrRepositoryWhat this check verifies
Amazon ECR repositories have a lifecycle policy configured to automatically expire container images based on age, count, or tags.Risk
Without lifecycle policies, images accumulate indefinitely, leading to:- Availability issues when quotas block pushes and CI/CD
- Integrity risk from redeploying outdated, vulnerable images
- Cost growth from unnecessary storage
Recommendation
Implement lifecycle policies per repository to expire untagged, old, or excess images and retain a small set of trusted releases. Validate outcomes before applying, review rules regularly, and apply consistently across Regions when replicating. This supports defense in depth by reducing image attack surface and operational risk.Remediation
- CLI
- Terraform
- Native IaC
- Dashboard steps
References
- https://docs.aws.amazon.com/AmazonECR/latest/userguide/LifecyclePolicies.html
- https://docs.aws.amazon.com/AmazonECR/latest/userguide/lp_creation.html
- https://aws.plainenglish.io/automation-deletion-untagged-container-image-in-amazon-ecr-using-ecr-lifecycle-policy-995eae2f5b8d
- https://blog.stackademic.com/title-implementing-lifecycle-policies-in-aws-ecr-a-practical-guide-3860b612b477
- https://www.trendmicro.com/trendaivisiononecloudriskmanagement/knowledge-base/aws/ECR/lifecycle-policy-in-use.html
Where this check fires
This check runs on every scheduled scan against your AWS account. Findings appear at Cloud Security → Findings filterable byCheck ID = ecr_repositories_lifecycle_policy_enabled. To re-evaluate after a fix, hit Run now on the account’s schedule under Cloud Security → Schedules — the next scan re-checks this control and marks the finding fixed or keeps it persistent.
← Back to AWS checks