AWS:大文件上传-API Gateway& Lambda-最佳做法 [英] AWS: Large File Upload - API Gateway & Lambda - Best Practices

查看:440
本文介绍了AWS:大文件上传-API Gateway& Lambda-最佳做法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要用户能够向AWS Lambda函数提供15 MB的XML文件,以便它执行操作,然后将另一个XML文件返回给用户.这是此应用程序"要做的唯一事情. XML文件中的数据是半敏感的,返回文件后不应保存在任何地方.

I need a user to be able to provide a 15 MB XML file to an AWS Lambda function for it to perform an action, and return another XML file back to the user. This is the only thing this "application" is going to do. The data in the XML file is semi-sensitive and shouldn't be kept anywhere after the file is returned.

处理此问题的最佳做法是什么? API网关的有效负载大小限制为10mb ,所以我不能只上传它.

What are the best practices for handling this? The API Gateway appears to have a payload size limit of 10mb, so I can't just upload it.

我已经看到一些有关将文件直接上传到S3,然后执行该操作自动触发Lambda函数的参考.但是,在这种情况下,用户如何从返回的Lambda函数获取输出文件?我真的不希望它久坐.

I've seen some references to having the file uploaded directly to S3, and then having that action trigger the Lambda function automatically. However, in this scenario, how does the user get the output file from the Lambda function returned? I really don't want it sitting around for a long time.

我希望这个应用程序尽可能简单.

I'm hoping to keep this application as simple as possible.

推荐答案

如果您正在考虑为此目的使用S3并使整个过程异步,则Lambda函数也可以将输出写入S3,然后生成预签名的url文件并将其发送回用户.您可以对S3存储桶执行生命周期策略,以在不再需要文件时将其删除,或者让另一个Lambda函数根据通知将其删除.

If you're considering using S3 for this purpose and making the whole process asynchronous your Lambda function can write the output to S3 as well, then generate presigned url to the file and send it back to the user. You can have lifecycle policy on S3 bucket to remove the files when they're not needed anymore or have another Lambda function deleting them based on the notification.

这篇关于AWS:大文件上传-API Gateway& Lambda-最佳做法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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