Run periodic sync to s3 using cron
1.2K
Sync a directory with S3 on cron.
Tiny alpine footprint with the latest AWS CLI and tini for house cleaning which is available on Docker Hub.
docker run \
-e S3_PATH=<target> \
-e CRON_SCHEDULE=<schedule> \
-e AWS_ACCESS_KEY_ID=<key> \
-e AWS_SECRET_ACCESS_KEY=<secret> \
-v <source>:/data \
javatarz/cron_s3_sync
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 | 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 |
AWS_ACCESS_KEY_ID | Mandatory | Access key for AWS S3 writes |
AWS_SECRET_ACCESS_KEY | Mandatory | Secret key for AWS S3 writes |
Content type
Image
Digest
Size
44 MB
Last updated
over 5 years ago
docker pull javatarz/cron_s3_sync