How to Copy a Local Folder to an S3 Bucket
How to Copy a Local Folder to an S3 Bucket
Use the s3 sync command with the source directory and destination bucket as inputs to copy the files from a local folder to an S3 bucket.
Let's examine a scenario where files are copied from the current directory to an S3 bucket.
Run the s3 sync command in the directory where the files you wish to copy are located in your terminal.
aws s3 sync . s3://YOUR_BUCKET
You can also pass the directory as an absolute path, for example:
# on Linux or macOS
aws s3 sync /home/john/Desktop/my-folder s3://YOUR_BUCKET
# on Windows
aws s3 sync C:\Users\USERNAME\my-folder s3://YOUR_BUCKET
Run the command in test mode by including the —dryrun argument to ensure that it behaves as you anticipate. As a result, we are able to display the command's output without really executing it.
aws s3 sync . s3://YOUR_BUCKET --dryrun
No comments