ECR Lifecycle policy for deleting "xyz" tagged images but not images with "xyz" tag as subset [xyz, abc,123]

0

I want to create an ECR rule in AWS that satisfies following conditions.

It should keep last 10 images with "dev" tag.

For example if an image is having a single tag like "dev-123" then that should be deleted whereas image having "dev-123" as subset [having multiple tags like "dev-123, stg-456, abc-789"] should not be deleted.

I have tried different rules but nothing work, can anyone please help me with this.

Raj
asked a year ago586 views
1 Answer
0

Hi, https://docs.aws.amazon.com/AmazonECR/latest/userguide/lifecycle_policy_examples.html#lifecycle_policy_example_number gives you proper example:

{
            "rulePriority": 1,
            "description": "Rule 1",
            "selection": {
            "tagStatus": "tagged",
             "tagPrefixList": ["prod"],
             "countType": "imageCountMoreThan",
              "countNumber": 1
 }

By changing countNumber to 10 and adapting tagPrefixList to your prefix, you should be able to achieve the cleanup that you want

profile pictureAWS
EXPERT
answered a year ago
  • Hi Didier, thanks for the answer but unfortunately this rule is also deleting the images that are having "dev" as the one of the tags in subset.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions