From c3bc95cea015a36737356ad12777ba0318d7f62e Mon Sep 17 00:00:00 2001 From: Josh Glendenning Date: Wed, 4 Dec 2024 18:16:35 -0600 Subject: [PATCH] Update ECR lifecycle policy to cut costs This retains only 100 images with master/main prefixed tags, 100 of any other tag, and any other images less than 90 days old. --- default-ecr-lifecycle-policy.json | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/default-ecr-lifecycle-policy.json b/default-ecr-lifecycle-policy.json index 107d391..d1a1fbb 100644 --- a/default-ecr-lifecycle-policy.json +++ b/default-ecr-lifecycle-policy.json @@ -7,7 +7,7 @@ "tagStatus": "tagged", "tagPrefixList": ["master", "main"], "countType": "imageCountMoreThan", - "countNumber": 1000 + "countNumber": 100 }, "action": { "type": "expire" @@ -19,7 +19,20 @@ "selection": { "tagStatus": "any", "countType": "imageCountMoreThan", - "countNumber": 5000 + "countNumber": 100 + }, + "action": { + "type": "expire" + } + }, + { + "rulePriority": 3, + "description": "Only retain non-master/main images less than 90 days old", + "selection": { + "tagStatus": "any", + "countType": "sinceImagePushed", + "countUnit": "days", + "countNumber": 90 }, "action": { "type": "expire"