Attach a lifecycle policy document to a repository.
Section: ECR
Set an ECR lifecycle policy
bash
bash
aws ecr put-lifecycle-policy --repository-name my-app --lifecycle-policy-text file://lifecycle-policy.jsonExplanation
Automates cleanup of old images based on age or tag rules.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing ECR
Describe image details
Inspect pushed images, tags, sizes, and timestamps.
Delete one or more images
Remove images from a repository by tag or digest.