使用 EC2 压缩 S3 文件
我正在尝试使用 EC2 压缩存储在 S3 存储桶中的一些文件。我已经成功地让 SWFUpload 使用 PHP 并将文件上传到 S3。我读到,压缩 S3 文件而不产生巨大传输成本的最佳方法是使用 EC2 来处理 S3。经过大量努力,我设法让 EC2 服务器运行并通过 SSH 连接到其中,但现在我不知道从这里做什么。
压缩 S3 文件并将其放回存储桶的最佳方法是什么?
理想情况下,用户的批量上传将触发 SQS,然后我每天启动一次 EC2 服务器以将它们全部压缩并将它们交还给 S3 进行下载。不知道从这里去哪里。有想法吗?
I am trying to use EC2 to zip up some files that are stored in an S3 bucket. I have gotten as far as successfully getting SWFUpload to work with PHP and upload the files to S3. I read that the best way to zip up S3 files without incurring huge transfer costs is to use EC2 to deal with S3. After a lot of effort I managed to get a EC2 server running and SSH into it, but now I don't know what to do from here.
What's the best way to zip S3 files and put them back in the bucket?
Ideally, a user's batch upload would trigger an SQS and then I'd spin up the EC2 server once a day to zip them all and hand them back to S3 for downloading. No idea where to go from here. Ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该查看 aws - 一个用于 ec2、s3 和其他 AWS 服务。
当您安装该工具并设置 AWS 凭证时,它将创建各种命令的方便符号链接 - 包括 s3。
总体思路是:
s3get
)gzip
)s3put
)如果您需要更多指针,请告诉我。
也许您想在上传之前用 PHP 压缩文件?这需要安装 zip 扩展。
这是一个示例脚本:
You should check out aws - a command line tool to ec2, s3 and other AWS services.
When you install the tool and setup your AWS credentials, it will create handy symlinks all kinds of commands -- including s3.
The general idea is:
s3get <bucket/file>
)gzip <file>
)s3put <file>
)Let me know if you need more pointers.
Maybe you want to zip the file in PHP before you upload them? This requires the zip extension to be installed.
Here is an example script: