s3sync-awscliv2

s3sync-awscliv2

Docker app from jterpstra's Repository

Overview

This application backs up every folder mounted at `/data/` to a given AWS S3 path using the `aws s3 sync` command. It requires a pair of (IAM) Access and Secret Keys. You can supply the usual s3 sync parameters such as `--delete` and everything else. The cron schedule defines how often the sync command is executed, and it uses a lockfile to avoid parallel executions. This app has been based on the already available s3sync, however that was outdated, this version contains AWS CLI V2 and doesn't rely on extra python packages.

s3sync

Info

S3sync is a Docker container which backs up one or more folders to S3 using the AWS CLI v2 tool.

Usage

This container makes use of the aws s3 sync command.

To tell s3sync what to back up, mount your desired volumes under the /data directory.

s3sync is configured by setting the following environment variables during the launch of the container.

Env variables

Env var Description Example
ACCESS_KEY your AWS access key AKIABV38RBV38RBV38B3
SECRET_KEY your AWS secret key ubuUbuBubUuuBbuveubviurvurud6rDU3qpU
REGION your bucket's region eu-west-1
S3PATH your S3 bucket and path s3://my-nice-bucket
S3SYNCPARAMS custom parameters to aws s3 sync --delete --storage-class GLACIER_IR

Cron schedule

Files are by default backed up once every hour. You can customize this behavior using an environment variable which uses the standard CRON notation. CRON_SCHEDULE is set to 0 * * * * by default, which means every hour. I would advise against setting this to a more frequent schedule.

Example invocation

Simple run

This will sync your /home/user local directory every hour to your specified S3 bucket, leaving everything else in the bucket intact.

docker run \
-v /home/user:/data/user:ro \
-e "ACCESS_KEY=AWS_ACCESS_KEY_HERE" \
-e "SECRET_KEY=AWS_SECRET_KEY_HERE" \
-e "REGION=eu-central-1" \
-e "S3PATH=s3://BUCKET_NAME_HERE" \
jvdgt/docker-s3sync

Advanced run

If you want more customization on the S3 side, you can use the S3SYNCPARAMS to input aws s3 sync CLI parameters such as --delete. You can also specify deeper paths in S3, and a cron schedule.

This will sync both the /home/user and /opt/files local folders to s3://your-bucket-name/this_prefix/ and delete everything else that's inside that prefix. Upon sync, the contents of s3://your-bucket-name/this_prefix/ will only be the two folders [and their files] that you just synced.

docker run \
-v /home/user:/data/user:ro \
-v /opt/files:/data/files:ro\
-e "ACCESS_KEY=AWS_ACCESS_KEY_HERE" \
-e "SECRET_KEY=AWS_SECRET_KEY_HERE" \
-e "REGION=eu-central-1" \
-e "S3PATH=s3://BUCKET_NAME_HERE/this_prefix" \
-e "S3SYNCPARAMS=--delete --storage-class GLACIER_IR" \
-e "CRON_SCHEDULE=* 0 * * *" \
jvdgt/docker-s3sync

Install s3sync-awscliv2 on Unraid in a few clicks.

Find s3sync-awscliv2 in Community Apps on your Unraid server, review the template, and click Install. Unraid handles the Docker app or plugin setup from the published template.

Open the Apps tab on your Unraid server Search Community Apps for s3sync-awscliv2 Review the template variables and paths Click Install

Categories

Download Statistics

221
Total Downloads

Related apps

Explore more like this

Explore all

Details

Repository
jvdgt/docker-s3sync
Last Updated2025-02-21
First Seen2025-03-03

Runtime arguments

Network
bridge
Shell
sh
Privileged
false

Template configuration

ACCESS_KEYVariable

Your AWS Access Key.

Value
YOUR_ACCESS_KEY
SECRET_KEYVariable

Your AWS Secret Key.

Value
YOUR_SECRET_KEY
RegionVariable

The region of your bucket.

Target
REGION
Value
eu-west-1
S3 Sync ParametersVariable

(Optional) Extra parameters for the s3 sync command.

Target
S3SYNCPARAMS
Value
--delete
S3 PathVariable

The target bucket path with optional prefix.

Target
S3PATH
Value
s3://YOUR_BUCKET_NAME
Cron ScheduleVariable

Cron schedule of backup.

Target
CRON_SCHEDULE
Value
0 * * * *
Backup Source ExamplePathro

This folder will be backed up.

Target
/data/example
Value
/mnt/user/exmaple/