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
Metadata
Release files for ecr-cleaner 0.1.11
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ecr_cleaner-0.1.11.tar.gz | 19.1 kB | Without provenance | Details for ecr_cleaner-0.1.11.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ecr_cleaner-0.1.11-py3-none-any.whl | Python 3 | none | any | Details for ecr_cleaner-0.1.11-py3-none-any.whl |
Total release size: 31.2 kB
Release files / ecr_cleaner-0.1.11.tar.gz
| Download URL | ecr_cleaner-0.1.11.tar.gz |
|---|---|
| Size | 19.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9ffa7ad25f01039b199ab9d7a7760aa511248625d9b3da94d6be661db0c0592d
|
|
BLAKE2b-256 checksum How to use checksums |
19824b13123c016951783bf162ef715489ba9e9aa4ec5719893121ffe5b13841
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.13.0
|
Release files / ecr_cleaner-0.1.11-py3-none-any.whl
| Download URL | ecr_cleaner-0.1.11-py3-none-any.whl |
|---|---|
| Size | 12.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f50d3592de9d472703d8084c03a9c555d600f5731b43954f7d96149f083bd8a3
|
|
BLAKE2b-256 checksum How to use checksums |
4de3718bfceaad253dd87ba5df28ce6d7b5129e6969b479fb3876717a8008e71
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.13.0
|
Security for ecr-cleaner 0.1.11
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.