s3-recent-file-cleaner/README.md
2024-12-28 21:09:18 +11:00

1.0 KiB

S3 Recent File Cleaner

Simple python script to loop through all files in an S3 Endpoint and delete excess files based on a retention amount.

Retention ammount: 5

Development

Python 3.12 should be used for development and ideally a virtual environment should be used. With the source checked out run the following command to create a virtual environment.

python3 -m venv ./

The required packages can be installed by running the following command after activating the virtual environment.

pip install -r requirements.txt

If new packages are installed, the requirements file can be updated by running the following command.

pip freeze > requirements.txt

Usage

The S3 Recent File Cleaner is best run as a once off docker image. The image is already built so can be run with the following command.

docker run --rm -e S3_ACCESS_KEY=your_access_key -e S3_SECRET_KEY=your_secret_key -e S3_ENDPOINT=your_endpoint liamsgit.dev/liampietralla/s3-recent-file-cleaner:latest