s5cmd sync: Fast S3 Directory Sync
s5cmd sync copies only new or changed objects between a source and S3, and with --delete removes extras at the destination.
sync gives s5cmd the incremental, mirror-style transfer of aws s3 sync but with s5cmd throughput. It is the fast path for keeping a bucket in step with build output or a cache.
What it does
s5cmd sync compares source and destination and transfers only what differs (by size, or timestamp plus size). With --delete it deletes destination objects absent from the source, making an exact mirror. Parallelism comes from the global --numworkers.
Common usage
s5cmd sync ./dist/ s3://my-bucket/site/
# exact mirror with deletions
s5cmd sync --delete ./dist/ s3://my-bucket/site/
# compare by size only (faster, ignores mtime)
s5cmd sync --size-only ./cache/ s3://my-bucket/cache/Options
| Flag | What it does |
|---|---|
| --delete | Remove destination objects not in the source |
| --size-only | Compare by size only, ignoring modification time |
| --exclude <pattern> | Skip matching keys |
| --numworkers N | Global parallel worker count |
| --exit-code | Exit non-zero if any object was transferred |
In CI
For a cache, --size-only avoids re-uploading files whose mtime changed but content did not, cutting transfer time. Use --delete only when you truly want the destination pruned; verify the argument order (SOURCE then DEST) so you do not mirror an empty directory over a good bucket.
Common errors in CI
"AccessDenied" on --delete but not on plain sync means the role lacks s3:DeleteObject. "NoSuchBucket" is a wrong bucket or region. "RequestTimeTooSkewed" is runner clock drift; fix NTP. A sync that re-uploads everything each run usually compared timestamps that differ after checkout; add --size-only.