如何将文件上传到lambda函数或API网关? [英] How to upload file to lambda function or API Gateway?

查看:688
本文介绍了如何将文件上传到lambda函数或API网关?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试将文件从iOS上传到AWS API网关,并将其传递给Lambda函数,我该如何实现这种情况?



我可以使用 multipart / form-data 上传到AWS API Gateway,但是如何使输入模型支持二进制数据?



[Edit1]从answer by Spektre



感谢您的回复,经过一番阅读后我发现无法将文件上传到lambda(这是不合逻辑的,因为它是基于事件的)并且唯一有效的用例上传到S3并使S3通知lambda。

解决方案

我强烈推荐使用直接 S3 使用 AWS SDK 之一上传。 AWS Lambda 适合处理短事件,而不是上传等内容传输。您可以查看其结算和限额,以便做出更明智的决定,看看它是否真的是您正在寻找的。

I'm try to upload file from iOS to AWS API Gateway and passthrough it to Lambda function, How can I implement this scenario?

I can use multipart/form-data to upload to AWS API Gateway but how make input Model support binary data?

[Edit1] moved from answer by Spektre

Thanks For response, after a little of reading I figure out that's no way to upload file to lambda (and it's not logical because it's event based) and the only valid use case to upload to S3 and make S3 notify lambda.

解决方案

I'd highly recommend using direct S3 upload using one of the AWS SDKs. AWS Lambda is suited to process just short events, not content transfers like uploads. You can check its billing and limits to make a more informed decision on if it's really something you're looking for.

这篇关于如何将文件上传到lambda函数或API网关?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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