简体   繁体   English

如何使用 AWS 网关和 S3 代理上传大文件

[英]How to upload large file using AWS Gateway and S3 proxy

I have AWS Gateway API configured as proxy for S3 to upload a file to S3 bucket.我将 AWS 网关 API 配置为 S3 的代理,以将文件上传到 S3 存储桶。 I have configured binary media to support multipart/form-data我已经配置了二进制媒体来支持multipart/form-data

I am able to upload a file of size 10MB or less without any issue.我可以毫无问题地上传大小为 10MB 或更小的文件。 However when the file size is more than 10MB i get 413 Request Entity Too Large issue.但是,当文件大小超过 10MB 时,我会收到413 Request Entity Too Large问题。

I know that AAG has hard limit of 10 MB on payload.我知道 AAG 对有效载荷有 10 MB 的硬限制。

Questions问题
1>Isn't adding multipart/form-data should solve the 10 MB limit issue? 1> 添加multipart/form-data不应该解决 10 MB 限制问题吗? Do i need to configure anything else?我还需要配置什么吗?

2>Another approach recommended is to create pre-signed url . 2>推荐的另一种方法是创建预签名 url I am assuming for this approach to work client has to make call to get pre-signed url and then use that url to upload a file.我假设这种工作方法的客户必须拨打电话以获得预签名 url,然后使用该 url 上传文件。 Is this the only approach to upload a large file?这是上传大文件的唯一方法吗?

Note that I have gone through several SO post regarding the same issue, but most of them are old and i am curious to see if there are any new recommendations.请注意,我已经浏览了几个关于同一问题的 SO 帖子,但其中大部分都是旧的,我很想知道是否有任何新的建议。

The 10 MB payload limit is hard and cannot be increased [ 1 ]. 10 MB 的负载限制是硬性的,不能增加 [ 1 ]。

It seems to be possible to split the file into chunks on the client and then put it together on the server again [ 2 ] to circumvent the 10 MB limit, but I do not think this is a reasonable approach.似乎可以在客户端将文件拆分成块,然后再次将它们放在服务器上 [ 2 ] 以规避 10 MB 的限制,但我认为这不是一个合理的方法。 The pre-signed URL approach seems better to me, if you do not use a client SDK which provides functionality for chunking.如果您不使用提供分块功能的客户端 SDK,预签名 URL 方法对我来说似乎更好。

Please note that if you ever decide to move away from S3, you can still implement the very same interface on any server yourself.请注意,如果您决定离开 S3,您仍然可以自己在任何服务器上实现完全相同的接口。 In my opinion it is therefore the way to go.因此,我认为这是通往 go 的路。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 AWS HTTP API 网关作为私有 S3 存储桶的代理 - AWS HTTP API Gateway as a proxy to private S3 bucket AWS FSx 与 S3 文件网关 - AWS FSx vs S3 File Gateway 如何使用 python 中的 AWS lambda function 将 excel 文件上传到 AWS S3 - How to upload excel file to AWS S3 using an AWS lambda function in python 使用预签名 URL 将文件上传到 AWS S3 - Upload file to AWS S3 using Pre-Signed URL 使用 ESP32 在 AWS S3 上上传 txt 文件 - Upload txt file on AWS S3 using ESP32 在 Node.js 中使用 lambda API 网关在 s3 中上传图像(aws-lambda-multipart-parser) - Image Upload in s3 using lambda API gateway in Node js (aws-lambda-multipart-parser) 通过托管在 ElasticBeansStalk 上的 API 网关在 AWS S3 上上传图像 - Upload image on AWS S3 through API Gateway hosted on ElasticBeansStalk 如何将在 Django 中创建的 CSV 文件上传到 AWS S3? - How to upload a CSV file that is created in Django to AWS S3? 如何使用节点、createPresignedPost 和获取将图像文件直接从客户端上传到 AWS S3 - How to upload an image file directly from client to AWS S3 using node, createPresignedPost, & fetch 如何使用 aws-cli 以 Cognito 用户身份将文件上传到 S3? - How to upload a file to S3 as a Cognito user by using aws-cli?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM