Upload Files to Aws S3

0 minute read

Upload single file to S3 bucket

1aws s3 cp sample2.txt s3://test-s3-bucket/data/

Upload all files from a folder to S3 bucket recursively

1aws s3 cp tmp/ s3://test-s3-bucket/data/tmp/ --recursive

Using Sync

Sync is a command used to synchronize source and target directories. Sync is by default recursive which means all the files and subdirectories in the source will be copied to target recursively.

Use the below command to Sync your local directory to your S3 bucket.

1aws s3 sync your_local_directory s3://full_s3_bucket_name/ --region "ap-southeast-2"

Source