user12735092
user12735092

Reputation: 33

How to upload a folder to s3 through the command line?

I've tried to copy my current folder to the bucket:

aws s3 cp path s3://bucket/NewFolder

but when I sync again using

aws s3 sync s3://bucket/NewFolder/ /home/test 

all I get is an empty folder meaning that my folder was not copied in the first place.

Upvotes: 3

Views: 8888

Answers (2)

Rex Andrew
Rex Andrew

Reputation: 408

Copy all content from the current folder, but not the folder itself:

For example, I am copying all the content from data folder which is located under NewFolder, with tgsbucket my bucket: aws s3 cp data s3://tgsbucket --recursive

Copy the local folder:

Specify folder name after bucket name: aws s3 cp data s3://tgsbucket/data --recursive

Upvotes: 8

John Rotenstein
John Rotenstein

Reputation: 270184

You can use this to copy a whole folder to S3:

aws s3 cp --recursive path s3://bucket/NewFolder

Or, sync the local folder to S3:

aws s3 sync path s3://bucket/NewFolder/

Upvotes: 7

Related Questions