LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

aws-s3-sync

Synchronize directories and S3 prefixes

TLDR

Sync a local directory to an S3 bucket
$ aws s3 sync [./local-dir] s3://[bucket-name]/
copy
Download S3 bucket to local directory
$ aws s3 sync s3://[bucket-name]/ [./local-dir]
copy
Sync between two S3 buckets
$ aws s3 sync s3://[source-bucket] s3://[dest-bucket]
copy
Sync and delete files not in source
$ aws s3 sync [./local-dir] s3://[bucket-name]/ --delete
copy
Sync excluding certain file types
$ aws s3 sync [./local-dir] s3://[bucket-name]/ --exclude "*.log"
copy
Preview sync operation without executing
$ aws s3 sync [./local-dir] s3://[bucket-name]/ --dryrun
copy
Sync only new files without overwriting
$ aws s3 sync [./local-dir] s3://[bucket-name]/ --no-overwrite
copy

SYNOPSIS

aws s3 sync source destination [options]

DESCRIPTION

aws s3 sync synchronizes directories and S3 prefixes by recursively copying new and updated files from the source to the destination. It only transfers files that are new or have changed, making it efficient for incremental backups and deployments.By default, sync compares file size and last modified time to determine which files need updating. It creates folders in the destination only if they contain files.

PARAMETERS

--delete

Delete destination files that don't exist in the source
--dryrun
Display operations that would be performed without executing them
--quiet
Suppress all output except errors
--no-overwrite
Only transfer files not present at the destination
--size-only
Use file size alone to determine if sync is needed (ignore timestamps)
--exact-timestamps
Match timestamps exactly when syncing from S3 to local
--include pattern
Include files matching the pattern
--exclude pattern
Exclude files matching the pattern from the sync
--acl value
Set access control list: private, public-read, etc.
--storage-class value
Specify storage class: STANDARD, STANDARD_IA, GLACIER, etc.
--source-region value
Source bucket region (required for cross-region S3 to S3 sync)

INSTALL

sudo dnf install aws
copy
sudo pacman -S aws-cli
copy
sudo apk add aws-cli
copy
sudo zypper install aws-cli
copy

CAVEATS

The --delete option removes files from the destination that don't exist in the source; use with caution. Pattern matching with --include and --exclude is order-dependent. When syncing to local, directories are not created unless they contain files. Sync does not preserve symbolic links.

SEE ALSO

aws-s3(1), aws-s3-cp(1), rsync(1)

RESOURCES

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid