s3-recent-file-cleaner/README.md

33 lines
1.0 KiB
Markdown
Raw Permalink Normal View History

2024-12-28 21:03:41 +11:00
# 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.
```bash
python3 -m venv ./
```
The required packages can be installed by running the following command after activating the virtual environment.
```bash
pip install -r requirements.txt
```
If new packages are installed, the requirements file can be updated by running the following command.
```bash
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.
```bash
2024-12-28 21:09:18 +11:00
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
2024-12-28 21:03:41 +11:00
```