Metadata-Version: 2.1
Name: cdk-ecrpublic-gc
Version: 0.1.49
Summary: Garbage collector for Amazon ECR public
Home-page: https://github.com/pahudnet/cdk-ecrpublic-gc.git
Author: Pahud Hsieh<pahudnet@gmail.com>
License: Apache-2.0
Project-URL: Source, https://github.com/pahudnet/cdk-ecrpublic-gc.git
Platform: UNKNOWN
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: JavaScript
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Typing :: Typed
Classifier: Development Status :: 5 - Production/Stable
Classifier: License :: OSI Approved
Requires-Python: >=3.6
Description-Content-Type: text/markdown
Requires-Dist: aws-cdk.aws-events-targets (<2.0.0,>=1.95.1)
Requires-Dist: aws-cdk.aws-events (<2.0.0,>=1.95.1)
Requires-Dist: aws-cdk.aws-iam (<2.0.0,>=1.95.1)
Requires-Dist: aws-cdk.aws-lambda-nodejs (<2.0.0,>=1.95.1)
Requires-Dist: aws-cdk.aws-lambda (<2.0.0,>=1.95.1)
Requires-Dist: aws-cdk.aws-stepfunctions-tasks (<2.0.0,>=1.95.1)
Requires-Dist: aws-cdk.aws-stepfunctions (<2.0.0,>=1.95.1)
Requires-Dist: aws-cdk.core (<2.0.0,>=1.95.1)
Requires-Dist: constructs (<4.0.0,>=3.2.27)
Requires-Dist: jsii (<2.0.0,>=1.30.0)
Requires-Dist: publication (>=0.0.3)

[![NPM version](https://badge.fury.io/js/cdk-ecrpublic-gc.svg)](https://badge.fury.io/js/cdk-ecrpublic-gc)
[![PyPI version](https://badge.fury.io/py/cdk-ecrpublic-gc.svg)](https://badge.fury.io/py/cdk-ecrpublic-gc)
![Release](https://github.com/pahud/cdk-ecrpublic-gc/workflows/Release/badge.svg)

# cdk-ecrpublic-gc

CDK construct library that helps you build a garbage collector to delete all untagged images in Amazon ECR public with AWS CDK.

# Why

Amazon ECR public does not have lifecycle policy to clean up all untagged images at this moment(see [this issue](https://github.com/aws/containers-roadmap/issues/1268)). `cdk-ecrpublic-gc` allows you to deploy a **AWS Step Functions** state machine with [dynamic parallelism](https://aws.amazon.com/tw/blogs/aws/new-step-functions-support-for-dynamic-parallelism/) to invoke an arbitrary of Lambda functions to remove untagged images to release the storage.

# Schedule

By default, the state machine will be triggered **every 4 hours** and can be configured in the `schedule` property in the `TidyUp` construct.

# Sample

```python
# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
import aws_cdk.core as cdk
from cdk_ecrpublic_gc import TidyUp

app = cdk.App()

stack = cdk.Stack(app, "ecr-public-gc")

TidyUp(stack, "TidyUp",
    repository=["vscode", "gitpod-workspace", "github-codespace"
    ],
    schedule=events.Schedule.cron(hour="*/4", minute="0")
)
```

# In Action

Step Function state machine with dynamic tasks in parallel
![](images/01.png)

![](images/02.png)


