AWS: Large File Upload - API Gateway & Lambda - Best Practices

旧城冷巷雨未停 提交于 2019-12-02 06:40:34

问题


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.

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.

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.


回答1:


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.



来源:https://stackoverflow.com/questions/40899319/aws-large-file-upload-api-gateway-lambda-best-practices

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!