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.11.tar.gz
(19.1 kB
view details)
Built Distribution
File details
Details for the file ecr_cleaner-0.1.11.tar.gz
.
File metadata
- Download URL: ecr_cleaner-0.1.11.tar.gz
- Upload date:
- Size: 19.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.13.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9ffa7ad25f01039b199ab9d7a7760aa511248625d9b3da94d6be661db0c0592d |
|
MD5 | 9a46d0f6e0c6018854de8779e68a9ecb |
|
BLAKE2b-256 | 19824b13123c016951783bf162ef715489ba9e9aa4ec5719893121ffe5b13841 |
File details
Details for the file ecr_cleaner-0.1.11-py3-none-any.whl
.
File metadata
- Download URL: ecr_cleaner-0.1.11-py3-none-any.whl
- Upload date:
- Size: 12.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.13.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f50d3592de9d472703d8084c03a9c555d600f5731b43954f7d96149f083bd8a3 |
|
MD5 | 08f791d078a854be0e3d0078f2107b67 |
|
BLAKE2b-256 | 4de3718bfceaad253dd87ba5df28ce6d7b5129e6969b479fb3876717a8008e71 |