基于Golang的Web服务器上传 /下载AWS S3对象

发布于 2025-02-07 17:56:50 字数 487 浏览 0 评论 0原文

这可能是一个非常基本的问题,但我正在寻找今天可用的最佳选择 /建议。

问题陈述: 我们有一个Web应用程序,该应用程序允许用户上传和下载文件(存储在S3中)。我们还希望服务器在开始上传 /下载之前先对请求进行身份验证。

几个选项

  1. 使用S3预先签名的URL:我当然想避免这种情况,因为这些是私人文件,任何可以访问预先签名URL的人都可以访问这些文件。 (我们甚至无法通过将预签名URL的到期时间设置为几秒钟来承担风险)
  2. 一旦完成了身份验证,请直接将数据直接传输到S3到客户端。这可能可行吗?我们有任何工具或参考实现吗?

这个问题可能是对过去类似问题的重复(但是它们很旧),我想知道我们今天有什么工具 /选项可以解决这个问题?

我主要是在Golang / Python寻找选项(Golang是可取的)。如果这使情况更容易,则很乐意考虑S3以外的其他存储服务(虽然偏好是S3)。

This might be a very basic problem but I am looking for the best options / recommendations available today.

Problem Statement:
We have a web app which allow users to upload and download files (stored in S3). We also want server to authenticate the request first before starting the upload / download.

Few options:

  1. Use S3 pre-signed URLs: I certainly want to avoid this because these are private files and anyone who gets access to the pre-signed URLS can access those. (We can't even afford to take risk by setting the expiration time of the pre-signed URL to few seconds)
  2. Once authentication is done, stream data directly to/from S3 to client. Is this possible and viable? Do we have any tools or reference implementation for this?

This question might be a repeat of similar questions from the past (but they are very old), I wonder what all tools / options we have today to solve this?

I am mostly looking for options in GoLang / Python (GoLang is preferable). Happy to consider storage services other than S3 if that makes things easier (preference will be S3 though).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文