简体   繁体   中英

Move 2000 objects from one S3 bucket to another

I need to move around 2000 S3 objects from one S3 bucket to another in the same region and in the same AWS account. I have a list of S3 keys which I need to move (Not every object in the bucket). If I'm using a forEach loop for each key and use s3Client.copyObject() then the request times out after 30 seconds and it is able to copy around 200 objects. What should I do in this situation.

My code looks like this

List<String> s3Keys;   // size of list is 1000
s3Keys.forEach(key -> 
    s3Client.copyObject(bucket1, key, bucket2, key)
);

It keeps running for 30 sec. and then times out.

您可能应该尝试使用 S3 批处理操作。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM