How do you set a lifecycle policy for an ECR for tagged with any prefix?

Viewed 2467

I want to set a lifecycle policy for my ECR. For all tagged images to have image count more than 1. It's currently set to Prefix and can't set it blank.

aws ecr policy console: enter image description here

Thanks in advance.

3 Answers

Lifecycle policies on all tagged images is now supported in ECR

You can use it by selecting Any for "Image Status". Alternatively in JSON, you can create a rule with "tagStatus": "any":

{
    "rules": [
        {
            "rulePriority": 1,
            "description": "Rule 1",
            "selection": {
                "tagStatus": "any",
                "countType": "imageCountMoreThan",
                "countNumber": 1
            },
            "action": {
                "type": "expire"
            }
        }
    ]
}

Related