19

Amazon Web Services - Command Line Interface (AWS-CLI) has a sync command. Unfortunately AWS CLI's sync method is a bit buggy. I'd like to sync to S3 using a gulp build process and Amazon's javascript/node SDK.

Unfortunately, the SDK doesn't seem to have a sync method, or does it?

What is the best way to sync whole directories in Node with AWS S3?

Keet Sugathadasa
  • 4,497
  • 1
  • 37
  • 53
Erik
  • 6,796
  • 7
  • 54
  • 97
  • 2
    https://github.com/pgherveou/gulp-awspublish – rab Aug 22 '14 at 18:44
  • 9
    Has anyone found out why aws-sdk doesn't offer a `sync` method? Here is the list of methods, and `sync` isn't in there: http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html – modulitos Aug 14 '17 at 06:57
  • You could use High Level Amazon S3 Client node-package, it has a `sync` option: https://www.npmjs.com/package/s3 – lofihelsinki Oct 01 '19 at 13:28

1 Answers1

1

The AWS CLI is more stable now. So, my solution:

gulp.task("sync-buckets", done => {
    let conf = loadConf();
    exec(`aws s3 sync --acl public-read bucket/www_static/ s3://${conf.BucketName}`, done);
});
bedorlan
  • 27
  • 1
  • 5