Search code examples
javascriptamazon-web-servicesamazon-s3meteor

Is it possible to upload to S3 via URL somehow? (Meteor.js)


I know that Amazon doesn't provide a pull service for S3, but is it possible to read an image on the server side and then upload it to S3?


Solution

  • The simplest way is to use the aws-sdk Node package. It's pretty well documented here. For uploading images you use the putObject method.

    Example:

    S3.putObject({
      Bucket: bucketName,
      ACL: 'private',
      Key: fileName,
      ContentType: fileMimeType,
      Body: new Buffer(fileContents, 'binary'),
    }, function(err, data) {
      ...
    });