最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Is s3 sync supported from sdk instead of cli? - Stack Overflow

programmeradmin3浏览0评论

Here is answer about how move files from one s3 bucket to another using sync mand from mand line (cli):

aws s3 sync s3://from_my_bucket s3://to_my_other_bucket

Can this be invoked from javascript sdk? With searching I did not find any sync named method. So is it supported in sdk?

Here is answer about how move files from one s3 bucket to another using sync mand from mand line (cli):

aws s3 sync s3://from_my_bucket s3://to_my_other_bucket

Can this be invoked from javascript sdk? With searching I did not find any sync named method. So is it supported in sdk?

Share Improve this question asked Sep 7, 2017 at 9:56 CherryCherry 33.6k73 gold badges242 silver badges394 bronze badges 0
Add a ment  | 

4 Answers 4

Reset to default 1

I found this really helpful article on cloning S3 bucket using Node.JS package "aws-sdk": [Node Clone S3 Bucket by Rajesh Babu][1]

I am quoting his approach here:

  • Fetch the list of Keys from the bucket and the target Prefix. (check AWS-SDK Javascript APIs)
  • Separate the files and directories, because we clone the directories and download the files.
  • Clone all the directories first, and then move on to download the files.
  • Download the files through streams and log success and failure respectively.
[1]: https://blog.bitsrc.io/a-practical-guide-to-building-a-node-js-service-on-an-aws-s3-bucket-aff19105ba83

You can see how this node package does it.

Basically, it makes use of several S3 instance methods to sync two buckets.

I needed to sync thousands of files, and decided to make use of AWS Data Pipeline to do it. I update the pipeline definition to point to the correct source and destination folders from my Lambda function, and then invoke it.

It uses 2 S3DataNodes and a CopyActivity.

This should be the defacto answer: No but there are official examples. Here is the README to their Go example: https://github./aws/aws-sdk-go/blob/main/example/service/s3/sync/README.md

发布评论

评论列表(0)

  1. 暂无评论