【问题标题】:Write to S3 bucket from code running in docker on EC2从 EC2 上的 docker 中运行的代码写入 S3 存储桶
【发布时间】:2017-08-27 07:01:14
【问题描述】:

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

'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);
  });
}

【问题讨论】:

    标签: meteor amazon-s3 amazon-ec2


    【解决方案1】:

    您需要使用适用于 AWS 的 NodeJS 开发工具包。

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

    直接例子——

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

    【讨论】:

      猜你喜欢
      • 2019-09-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-03-07
      • 2018-05-05
      • 1970-01-01
      • 1970-01-01
      • 2019-12-06
      相关资源
      最近更新 更多