且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何将文件上传到lambda函数或API网关?

更新时间:2022-12-13 13:44:00

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

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.