1
votes

Using the s3 client of aws-sdk for nodejs, I upload contents from a local directory to a remote bucket like this.

 var s3_bucket = new AWS.S3({params:{Bucket: 'bucket_name'}});
 s3_bucket.upload(params,callback)

How can 'upload' method be used for syncing 2 s3 buckets? Or is there another method available to do this? I did not find the "sync" method which is otherwise available in aws cli.

1

1 Answers

1
votes

To sync two s3 buckets you can trigger a Lambda event, when a file is uploaded to one bucket where the Lambda function will use AWS S3 SDK to copy the file from one bucket to another. This will asynchronously copy the file into the other bucket.