ECR Image Cleanup Tool
Project description
ECR Image Cleanup Tool
Table of Contents
Overview
The ECR Image Cleanup Tool addresses limitations in Amazon ECR's built-in lifecycle policies, particularly for multi-architecture images. It helps prevent repositories from hitting the 10,000 image hard limit imposed by ECR by providing more flexible and architecture-aware cleanup options.
Features
- Supports multi-architecture image cleanup
- Allows fine-grained control over image retention
- Can keep a specified number of recent images for each tag
- Manages untagged images separately
- Provides a dry-run option to preview actions before execution
Installation
pip install ecr-cleaner
Usage
Support following CLI argument
usage: ecr_cleaner [-h] [--config-file CONFIG_FILE] [--repositories REPOSITORIES [REPOSITORIES ...]] [--region REGION] [--batch-size BATCH_SIZE] [--dry-run] [--debug]
ECR Cleaner CLI
options:
-h, --help show this help message and exit
--config-file CONFIG_FILE
Path to configuration file in YAML format. See example in README.md
--repositories REPOSITORIES [REPOSITORIES ...]
List of repository names and policies(keep-most-recent). (e.g. my-repo:latest=3,tag-prefix=2,untagged=10)
--region REGION ECR region
--batch-size BATCH_SIZE
Max number of images that can be deleted in one call
--dry-run Check result without deleting images
--debug Enable debug logging
Clean-up will keep most recent number of images based on inputs and it will delete remaining matching tagPrefix
Config example
region: eu-central-1
repositories:
- rahul-test:pinned=1,untagged=3
Helm chart
Prerequisites
AWS IAM role permission to manage ECR repositories
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "ecr-cleaner",
"Effect": "Allow",
"Action": [
"ecr:BatchDeleteImage",
"ecr:BatchGetImage",
"ecr:DescribeImages",
"ecr:ListImages",
"ecr:DescribeRepositories"
]
}
]
}
Installation
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ecr_cleaner-0.1.8.tar.gz
(18.9 kB
view hashes)
Built Distribution
Close
Hashes for ecr_cleaner-0.1.8-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 23c947ccfad0423f18c87d75880c26dc35c7d49c31c0e00e0c68b23d28745005 |
|
MD5 | 53a9bb6cde5e415e088ad88d126f77f7 |
|
BLAKE2b-256 | c58e916eb2509afcae75dc11d7ca62a5d577e92563fa970218a492dfbb80b99e |