ecr-cleaner


Nameecr-cleaner JSON
Version 0.1.11 PyPI version JSON
download
home_pageNone
SummaryECR Image Cleanup Tool
upload_time2024-10-24 17:39:15
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseNone
keywords aws cleanup ecr package python
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ## ECR Image Cleanup Tool

![Build Status](https://github.com/rahulinux/ecr-cleaner/actions/workflows/python-tests.yml/badge.svg)
[![PyPI version](https://badge.fury.io/py/ecr-cleaner.svg)](https://badge.fury.io/py/ecr-cleaner)
[![Python Versions](https://img.shields.io/pypi/pyversions/ecr-cleaner.svg)](https://pypi.org/project/ecr-cleaner/)
[![License](https://img.shields.io/github/license/rahulinux/ecr-cleaner.svg)](LICENSE)

## Table of Contents
- [Overview](#overview)
- [Features](#features)
- [Installation](#installation)
- [Usage](#usage)


## 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

1. Supports multi-architecture image cleanup
2. Allows fine-grained control over image retention
3. Can keep a specified number of recent images for each tag
4. Manages untagged images separately
5. Provides a dry-run option to preview actions before execution


### Installation

```shell
pip install ecr-cleaner
```

### Usage

Support following CLI argument

```shell
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

```yaml
region: eu-central-1
repositories:
  - rahul-test:pinned=1,untagged=3
```

## Helm chart

## Prerequisites

AWS IAM role permission to manage ECR repositories

```json
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "ecr-cleaner",
      "Effect": "Allow",
      "Action": [
        "ecr:BatchDeleteImage",
        "ecr:BatchGetImage",
        "ecr:DescribeImages",
        "ecr:ListImages",
        "ecr:DescribeRepositories"
      ]
    }
  ]
}
```

## Installation

[Helm Readme](./charts/ecr-cleaner/README.md)

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "ecr-cleaner",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "aws, cleanup, ecr, package, python",
    "author": null,
    "author_email": "Rahul Patil <4476687+rahulinux@users.noreply.github.com>",
    "download_url": "https://files.pythonhosted.org/packages/19/82/4b13123c016951783bf162ef715489ba9e9aa4ec5719893121ffe5b13841/ecr_cleaner-0.1.11.tar.gz",
    "platform": null,
    "description": "## ECR Image Cleanup Tool\n\n![Build Status](https://github.com/rahulinux/ecr-cleaner/actions/workflows/python-tests.yml/badge.svg)\n[![PyPI version](https://badge.fury.io/py/ecr-cleaner.svg)](https://badge.fury.io/py/ecr-cleaner)\n[![Python Versions](https://img.shields.io/pypi/pyversions/ecr-cleaner.svg)](https://pypi.org/project/ecr-cleaner/)\n[![License](https://img.shields.io/github/license/rahulinux/ecr-cleaner.svg)](LICENSE)\n\n## Table of Contents\n- [Overview](#overview)\n- [Features](#features)\n- [Installation](#installation)\n- [Usage](#usage)\n\n\n## Overview\n\nThe 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.\n\n## Features\n\n1. Supports multi-architecture image cleanup\n2. Allows fine-grained control over image retention\n3. Can keep a specified number of recent images for each tag\n4. Manages untagged images separately\n5. Provides a dry-run option to preview actions before execution\n\n\n### Installation\n\n```shell\npip install ecr-cleaner\n```\n\n### Usage\n\nSupport following CLI argument\n\n```shell\nusage: ecr_cleaner [-h] [--config-file CONFIG_FILE] [--repositories REPOSITORIES [REPOSITORIES ...]] [--region REGION] [--batch-size BATCH_SIZE] [--dry-run] [--debug]\n\nECR Cleaner CLI\n\noptions:\n  -h, --help            show this help message and exit\n  --config-file CONFIG_FILE\n                        Path to configuration file in YAML format. See example in README.md\n  --repositories REPOSITORIES [REPOSITORIES ...]\n                        List of repository names and policies(keep-most-recent). (e.g. my-repo:latest=3,tag-prefix=2,untagged=10)\n  --region REGION       ECR region\n  --batch-size BATCH_SIZE\n                        Max number of images that can be deleted in one call\n  --dry-run             Check result without deleting images\n  --debug               Enable debug logging\n```\n\nClean-up will keep most recent number of images based on inputs and it will delete remaining matching tagPrefix\n\n## Config example\n\n```yaml\nregion: eu-central-1\nrepositories:\n  - rahul-test:pinned=1,untagged=3\n```\n\n## Helm chart\n\n## Prerequisites\n\nAWS IAM role permission to manage ECR repositories\n\n```json\n{\n  \"Version\": \"2012-10-17\",\n  \"Statement\": [\n    {\n      \"Sid\": \"ecr-cleaner\",\n      \"Effect\": \"Allow\",\n      \"Action\": [\n        \"ecr:BatchDeleteImage\",\n        \"ecr:BatchGetImage\",\n        \"ecr:DescribeImages\",\n        \"ecr:ListImages\",\n        \"ecr:DescribeRepositories\"\n      ]\n    }\n  ]\n}\n```\n\n## Installation\n\n[Helm Readme](./charts/ecr-cleaner/README.md)\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "ECR Image Cleanup Tool",
    "version": "0.1.11",
    "project_urls": {
        "Bug reports": "https://github.com/rahulinux/ecr-cleaner/issues/new",
        "Documentation": "https://github.com/rahulinux/ecr-cleaner/blob/main/python/README.md",
        "Source": "https://github.com/rahulinux/ecr-cleaner"
    },
    "split_keywords": [
        "aws",
        " cleanup",
        " ecr",
        " package",
        " python"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4de3718bfceaad253dd87ba5df28ce6d7b5129e6969b479fb3876717a8008e71",
                "md5": "08f791d078a854be0e3d0078f2107b67",
                "sha256": "f50d3592de9d472703d8084c03a9c555d600f5731b43954f7d96149f083bd8a3"
            },
            "downloads": -1,
            "filename": "ecr_cleaner-0.1.11-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "08f791d078a854be0e3d0078f2107b67",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 12137,
            "upload_time": "2024-10-24T17:39:13",
            "upload_time_iso_8601": "2024-10-24T17:39:13.726419Z",
            "url": "https://files.pythonhosted.org/packages/4d/e3/718bfceaad253dd87ba5df28ce6d7b5129e6969b479fb3876717a8008e71/ecr_cleaner-0.1.11-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "19824b13123c016951783bf162ef715489ba9e9aa4ec5719893121ffe5b13841",
                "md5": "9a46d0f6e0c6018854de8779e68a9ecb",
                "sha256": "9ffa7ad25f01039b199ab9d7a7760aa511248625d9b3da94d6be661db0c0592d"
            },
            "downloads": -1,
            "filename": "ecr_cleaner-0.1.11.tar.gz",
            "has_sig": false,
            "md5_digest": "9a46d0f6e0c6018854de8779e68a9ecb",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 19060,
            "upload_time": "2024-10-24T17:39:15",
            "upload_time_iso_8601": "2024-10-24T17:39:15.038850Z",
            "url": "https://files.pythonhosted.org/packages/19/82/4b13123c016951783bf162ef715489ba9e9aa4ec5719893121ffe5b13841/ecr_cleaner-0.1.11.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-24 17:39:15",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "rahulinux",
    "github_project": "ecr-cleaner",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "ecr-cleaner"
}
        
Elapsed time: 1.13109s