How do you enable immutable tags and lifecycle rules in ECR?
IntermediateProductionRegistries, Tagging & Supply Chain
Answer
aws ecr put-image-tag-mutability --repository-name app --image-tag-mutability IMMUTABLE
aws ecr put-lifecycle-policy --repository-name app --lifecycle-policy-text file://policy.json
A lifecycle policy example: keep last 30 images tagged v*, expire untagged images after 7 days. This controls storage cost and prevents accidental overwrites. Newer ECR supports exclusion patterns to keep some tags mutable.
More on Registries, Tagging & Supply Chain
What is a good image tagging strategy for production?BeginnerWhy is deploying by digest better than by tag?IntermediateHow does ECR handle scanning and replication?IntermediateHow do you give an EKS node or CI job access to ECR with least privilege?IntermediateDocker Hub vs ECR vs GHCR vs Harbor: how do you choose?IntermediateHow do you set up a pull-through cache for Docker Hub?Intermediate