Sign inSign up

breadheadhub/docker-aws-s3-sync

By breadheadhub

•Updated over 7 years ago

Image
0

91

breadheadhub/docker-aws-s3-sync repository overview

⁠futurevision/aws-s3-sync

Docker container that periodically syncs afolder to Amazon S3 or backward using the AWS Command Line Interface tool⁠ and cron.

⁠Usage

docker run -d [OPTIONS] breadheadhub/docker-aws-s3-sync
⁠Required Parameters:
  • -e KEY=<KEY>: User Access Key
  • -e SECRET=<SECRET>: User Access Secret
  • -e REGION=<REGION>: Region of your bucket
  • -e BUCKET=<BUCKET>: The name of your bucket
  • -e DATA_PATH=<DATA_PATH>: The name of your bucket
  • -v /path/to/backup:/data:ro: mount target local folder to container's data folder. Content of this folder will be synced with S3 bucket.
⁠Optional parameters:
  • -e PARAMS=: parameters to pass to the sync command (full list here⁠).
  • -e BUCKET_PATH=<BUCKET_PATH>: The path of your s3 bucket where the files should be synced to (must start with a slash), defaults to "/" to sync to bucket root
  • -e CRON_SCHEDULE="0 1 * * *": specifies when cron job starts (details⁠), defaults to 0 1 * * * (runs every night at 1:00).
  • now: run container once and exit (no cron scheduling).

⁠Examples:

Sync every hour with cron schedule (container keeps running):

docker run -d \
    -e KEY=mykey \
    -e SECRET=mysecret \
	-e REGION=region \
    -e BUCKET=mybucket \
    -e CRON_SCHEDULE="0 * * * *" \
	-e BUCKET_PATH=/path \
    -v /home/user/data:/data:ro \
    futurevision/aws-s3-sync

Sync just once (container is deleted afterwards):

docker run --rm \
    -e KEY=mykey \
    -e SECRET=mysecret \
	-e REGION=region \
    -e BUCKET=mybucket \
    -v /home/user/data:/data:ro \
    breadheadhub/docker-aws-s3-sync now

Sync backward (from Amazon to local folder) every hour with cron schedule (container keeps running):

docker run -d \
    -e KEY=mykey \
    -e SECRET=mysecret \
	-e REGION=region \
    -e BUCKET=mybucket \
    -e CRON_SCHEDULE="0 * * * *" \
	-e BUCKET_PATH=/path \
    -v /home/user/data:/data:ro \
    breadheadhub/docker-aws-s3-sync backward

Sync backward (from Amazon to local folder) just once (container is deleted afterwards):

docker run --rm \
    -e KEY=mykey \
    -e SECRET=mysecret \
	-e REGION=region \
    -e BUCKET=mybucket \
    -v /home/user/data:/data:ro \
    breadheadhub/docker-aws-s3-sync backward-now

⁠Credits

This container is heavily inspired by istepanov/backup-to-s3⁠.

The main difference is that this container is using Alpine Linux instead of Debian to be more light weight. It also uses a different method of using the AWS CLI tool.

Tag summary

Content type

Image

Digest

Size

33.9 MB

Last updated

over 7 years ago

docker pull breadheadhub/docker-aws-s3-sync