https://github.com/javatarz/cron_s3_sync
Docker image to run periodic sync to s3 using cron
https://github.com/javatarz/cron_s3_sync
docker-image dockerfile dockerhub-image
Last synced: about 2 months ago
JSON representation
Docker image to run periodic sync to s3 using cron
- Host: GitHub
- URL: https://github.com/javatarz/cron_s3_sync
- Owner: javatarz
- License: apache-2.0
- Created: 2021-01-03T21:47:34.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2021-01-04T06:48:08.000Z (over 5 years ago)
- Last Synced: 2025-04-10T14:07:48.667Z (about 1 year ago)
- Topics: docker-image, dockerfile, dockerhub-image
- Language: Shell
- Homepage: https://hub.docker.com/r/javatarz/cron_s3_sync
- Size: 16.6 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Backup directory to S3 on cron using docker
Sync a directory with S3 on cron.
Tiny [alpine](https://hub.docker.com/_/alpine) footprint with the latest [AWS CLI](https://pypi.org/project/awscli/) and [tini for house cleaning](https://github.com/krallin/tini/issues/8#issuecomment-146135930) which is available on [Docker Hub](https://hub.docker.com/r/javatarz/cron_s3_sync).
## Usage
### Docker Run
```bash
docker run \
-e S3_PATH= \
-e CRON_SCHEDULE= \
-e AWS_ACCESS_KEY_ID= \
-e AWS_SECRET_ACCESS_KEY= \
-v :/data \
javatarz/cron_s3_sync
```
### Docker compose
```yaml
backup_to_s3:
build: backup_to_s3
container_name: backup_to_s3
environment:
- S3_PATH=s3://some-bucket
- CRON_SCHEDULE=0 * * * *
env_file:
- ./secrets/backup_to_s3/env
volumes:
- ./data:/data
restart: unless-stopped
```
## Environment variables
| Environment Variables | Type | Description
| :--------------------- | :-------- | :----
| `PARAMS` | Optional | `aws s3 sync --help`
| `DATA_PATH` | Optional | source directory to read from
| `S3_PATH` | Mandatory | target for s3 sync
| `CRON_SCHEDULE` | Mandatory | schedule as [supported by crontab](https://crontab.guru)
| `AWS_ACCESS_KEY_ID` | Mandatory | Access key for AWS S3 writes
| `AWS_SECRET_ACCESS_KEY` | Mandatory | Secret key for AWS S3 writes