从EC2

时间:2017-08-26 22:48:02

标签: meteor amazon-s3 amazon-ec2

此Meteor服务器代码在各个地方被调用,在我的本地开发服务器上运行的代码将文件保存到硬盘驱动器。
但现在它在AWS EC2 Docker容器上运行,我该如何将文件写入S3存储桶? THX

'saveToFile': function (fileName, text) {
   if (env != 'development') return;
   const playPath = '/Users/localPath/' + fileName + '.html';
   fs.writeFile(playPath, text, (err) => {
   if (err) throw err;
     console.log(`Saved to ` + fileName);
  });
}

1 个答案:

答案 0 :(得分:0)

您需要使用NodeJS SDK for AWS。

https://aws.amazon.com/sdk-for-node-js/

直接示例 -

https://gist.github.com/homam/8646090