Reputation: 21
I have a list of files that i want to copy from one s3 bucket for another. I know i can create a loop iterating over the file names and copy them using aws s3 cp command
.
But there are hundreds of files and i don't want to make that many api calls. Is there any other way to achieve this?
Upvotes: 1
Views: 318
Reputation: 35188
Rather than programatically looping over AWS provides a single command to allow you to synchronise files with only those that have changed being copied.
To do this use the sync command from the CLI.
An example of this is below
aws s3 sync s3://mybucket s3://mybucket2
Under the hood this is managing the listing and copying in the most efficient way that is possible, and as I mentioned should only copy the files if they have changed or are new in the destination bucket.
Upvotes: 1