如何在 Amazon s3 Bucket 中压缩文件并获取其 URL [英] How to zip files in Amazon s3 Bucket and get its URL

查看:23
本文介绍了如何在 Amazon s3 Bucket 中压缩文件并获取其 URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Amazon s3 存储桶中有一堆文件,我想压缩这些文件并使用 Java Spring 通过 S3 URL 下载获取内容.

I have a bunch of files inside Amazon s3 bucket, I want to zip those file and download get the contents via S3 URL using Java Spring.

推荐答案

S3 不是文件服务器,也不提供操作系统文件服务,例如数据操作.

S3 is not a file server, nor does it offer operating system file services, such as data manipulation.

如果有很多HUGE"文件,你最好的选择是

If there is many "HUGE" files, your best bet is

  1. 启动一个简单的 EC2 实例
  2. 将所有这些文件下载到 EC2 实例,压缩它们,使用新的对象名称将其重新上传回 S3 存储桶

是的,您可以使用 AWS lambda 来做同样的事情,但 lambda 的执行超时时间是 900 秒(15 分钟)(因此建议分配更多 RAM 以提高 lambda 执行性能)

Yes, you can use AWS lambda to do the same thing, but lambda is bounds to 900 seconds (15 mins) execution timeout (Thus it is recommended to allocate more RAM to boost lambda execution performance)

从 S3 到本地区域 EC2 实例等服务的流量是免费的.

Traffics from S3 to local region EC2 instance and etc services is FREE.

如果您的主要目的只是使用 EC2/etc 服务读取同一 AWS 区域内的那些文件,那么您不需要这个额外的步骤.直接访问文件即可.

If your main purpose is just to read those file within same AWS region using EC2/etc services, then you don't need this extra step. Just access the file directly.

(更新):正如@Robert Reiz 所提到的,现在您也可以使用 AWS Fargate 来完成这项工作.

(Update) : As mentioned by @Robert Reiz, now you can also use AWS Fargate to do the job.

注意:

建议使用 AWS API 访问和共享文件.如果您打算公开共享该文件,则必须认真研究安全问题并施加下载限制.AWS 到互联网的流量从来都不便宜.

It is recommended to access and share file using AWS API. If you intend to share the file publicly, you must look into security issue seriously and impose download restriction. AWS traffics out to internet is never cheap.

这篇关于如何在 Amazon s3 Bucket 中压缩文件并获取其 URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆