Skip to content

Page modification request: aws s3 sync #18192

@peterjpxie

Description

@peterjpxie

Command description

aws s3 sync command is incorrect.

Current doc of aws s3:

  aws s3

  CLI for AWS S3 - provides storage through web services interfaces.
  Some subcommands such as `cp` have their own usage documentation.
  More information: https://awscli.amazonaws.com/v2/documentation/api/latest/reference/s3/index.html.

  - Show files in a bucket:
    aws s3 ls bucket_name

  - Sync files and directories from local to bucket:
    aws s3 sync path/to/file1 path/to/file2 ... s3://bucket_name        *** incorrect

  - Sync files and directories from bucket to local:
    aws s3 sync s3://bucket_name path/to/target

  - Sync files and directories with exclusions:
    aws s3 sync path/to/file1 path/to/file2 ... s3://bucket_name --exclude path/to/file --exclude path/to/directory/*

Example of failure:

root@ip-172-26-1-210:~/temp2# aws s3 ls px.backup
2025-09-24 10:22:10   26156971 data.20250924.tar.gz
root@ip-172-26-1-210:~/temp2# ls
a.txt

# failed as per example
root@ip-172-26-1-210:~/temp2# aws s3 sync ./a.txt s3://px.backup
warning: Skipping file /root/temp2/a.txt/. File does not exist.

# correct example
root@ip-172-26-1-210:~/temp2# cd ..
root@ip-172-26-1-210:~# aws s3 sync temp2 s3://px.backup
upload: temp2/a.txt to s3://px.backup/a.txt

root@ip-172-26-1-210:~# aws s3 ls px.backup
2025-09-24 10:59:42          0 a.txt
2025-09-24 10:22:10   26156971 data.20250924.tar.gz

aws s3 sync help:

root@ip-172-26-1-210:~# aws s3 sync help |more
SYNC()                                                                  SYNC()



NAME
       sync -

DESCRIPTION
       Syncs  **directories**  and S3 prefixes. Recursively copies new and updated
       files from the source directory to the destination. Only creates  fold-
       ers in the destination if they contain one or more files.

SYNOPSIS
            sync
          <LocalPath> <S3Uri> or <S3Uri> <LocalPath> or <S3Uri> <S3Uri>
          [--dryrun]
          [--quiet]
          [--include <value>]
          [--exclude <value>]

sync seems to support only 1 LocalPath and it is directory only.

Command details

aws-cli/2.31.0

Documentation

https://docs.aws.amazon.com/cli/latest/reference/s3/#directory-and-s3-prefix-operations

Platform

Common

VCS repository link (e.g. GitHub, GitLab)

No response

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedYou can help make tldr-pages better!page editChanges to an existing page(s).

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions