简体   繁体   English

我如何使用aws lambda函数和python在S3上上传大于2 mb的大图像

[英]how can i upload large image of around greater than 2 mb on S3 with aws lambda function with python

I am using aws lambda function with python3 and trying to upload > 1mb image on s3 but unable to upload it the problem is aws lambda doesn't support multipart upload so i am uploading as base64 from json but when image is big their base64 is also big and it crosses the raw input limit of aws lambda function but in actual i can only able to upload 70 kb image nothing more than that can someone guide me how can i do that 我在python3上使用aws lambda函数,并尝试在s3上上传> 1mb图像,但无法上传,问题是aws lambda不支持分段上传,所以我从json作为base64进行上传,但是当图像很大时,它们的base64也是大,它超过了AWS Lambda函数的原始输入限制,但实际上我只能上传70 kb的图像,无非是有人可以指导我该怎么做

I have already tried base64 but it gives issue in larger size than 70kb of image 我已经尝试过base64,但是它会产生大于70kb图片的问题

Take a look here: https://aws.amazon.com/about-aws/whats-new/2016/11/binary-data-now-supported-by-api-gateway/ 在这里看看: https : //aws.amazon.com/about-aws/whats-new/2016/11/binary-data-now-supported-by-api-gateway/

Keep in mind that API Gateway has a request size limit of 10 MB. 请记住,API网关的请求大小限制为10 MB。 AWS Lambda has a request size limit of 6 MB. AWS Lambda的请求大小限制为6 MB。

When you base64 encode an image it is roughly 33% bigger than the original object. 当您对图像进行base64编码时,它大约比原始对象大33%。

AWS claims the request size limit is 6MB but I have found that often times it is closer to 4MB. AWS声称请求大小限制为6MB,但我发现通常它接近4MB。

I think what you'll want to do is use a pre-signed url to bypass lambda all together. 我认为您想要做的是使用预签名的网址一起绕过lambda。

Multi-part presigned url with boto3 带boto3的多部分预签名网址

暂无
暂无

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

相关问题 如何使用 python 中的 AWS lambda function 将 excel 文件上传到 AWS S3 - How to upload excel file to AWS S3 using an AWS lambda function in python 如何在 S3 上存储大型 Python 依赖项(适用于无服务器的 AWS Lambda) - How to Store Large Python Dependencies on S3 (for AWS Lambda with Serverless) 如何使用AWS Lambda通过创建临时文件将“文件”上传到S3? - How can I upload a 'file' to S3 by creating a temp file, using AWS Lambda? 我应该如何将我的s3凭据传递给AWS上的Python lambda函数? - How should I pass my s3 credentials to Python lambda function on AWS? 如何使用 AWS Lambda 函数从 S3 解码 a.gz 文件? - How can I decode a .gz file from S3 using an AWS Lambda function? 如何使用Lambda将AWS CodeCommit推送到S3? - How can I push AWS CodeCommit to S3 using Lambda? AWS Lambda:如何管理大于 250mb 的部署包 - AWS Lambda: How to manage deployment packages greater than 250mb AWS lambda:在本地调用可访问 s3 的 python lambda 函数 - AWS lambda: Invoking locally a python lambda function with access to s3 如何将 csv 文件从 Lambda 上传到 S3 存储桶? “[ERROR] KeyError: 'Records' 并且我的 lambda 函数也没有被 s3 触发 - How can I upload the csv files from Lambda to an S3 bucket? "[ERROR] KeyError: 'Records' and my lambda function is also not getting triggered by s3 如何在AWS Lambda(python)中上传zip文件夹而不存储在S3中 - How to upload a zip folder in AWS lambda (python) without storing in S3
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM