aws,

How to upload files to S3 while preserving directory structure

Mar 17, 2022 · 1 min read · Post a comment

Preserving the directory structure while uploading files to S3 could be a handy thing especially if you want to copy these files later to an EBS volume. The solution is pretty simple as shown below.

Prerequisites

  • AWS CLI

Solution

Step 1. Use the aws s3 sync command.

aws s3 sync <local_dir_path>/ s3://some-bucket-name

Conclusion

Official docs for AWS s3 sync command. On a side note, follow our official channel on Telegram.