简体   繁体   English

API 网关 - 从 S3 读取文件,该文件刚刚由 lambda function 在同一 Z65E8800B5C6806AAD8 端点上创建

[英]API Gateway - Read file from S3 which just created by a lambda function on the same rest endpoint

I have created a lambda function to convert a file on S3 and put the new converted file back to S3, the lambda function is triggered by rest api on api gateway. I have created a lambda function to convert a file on S3 and put the new converted file back to S3, the lambda function is triggered by rest api on api gateway. What I want to do is to reply the client by that same converted file when accessing the same endpoint.我想要做的是在访问同一个端点时通过同一个转换文件回复客户端。 The option that I have in my mind is to return the file from lambda, which may not be a time optimized solution.我的想法是从 lambda 返回文件,这可能不是时间优化的解决方案。 My question is there another possible solution?我的问题是还有另一种可能的解决方案吗? like calling the lambda function and forward the request to the created object in S3?就像调用 lambda function 并将请求转发到 S3 中创建的 object 一样? I thought of forwarding one api resource to another one which will read from S3 directly, is it possible somehow?我想将一个 api 资源转发到另一个将直接从 S3 读取的资源,这可能吗?

You probably want to return a pre-signed S3 url for the file you've just created, which the client can then follow (at most once, and for a limited time), to download that file directly from S3.您可能希望为您刚刚创建的文件返回一个预签名的 S3 url,然后客户端可以按照该文件(最多一次,并且在有限的时间内)直接从 S3 下载该文件。 The general documentation is here , but there will probably be a helper for it in an SDK for whatever language you're using.一般文档在这里,但是对于您使用的任何语言,SDK 中可能会有一个帮助程序。

Remember that API Gateway has a maximum timeout of 29 seconds.请记住,API 网关的最大超时时间为 29 秒。 This is probably fine if you're just moving small amounts of data around in S3, but it's worth being aware of!如果您只是在 S3 中移动少量数据,这可能很好,但值得注意!

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

相关问题 使用与调用 API 网关端点的用户相同的权限运行 Lambda 函数 - Run Lambda function with same permissions as user invoking API Gateway endpoint 如何从 Lambda 中的 s3 (cloudtrail) 读取日志文件 function - How to read log file from s3 (cloudtrail) in Lambda function 是否可以通过AWS API Gateway和lambda函数将PDF文件上传到S3存储桶? - Is it possible to upload a PDF file through AWS API Gateway and a lambda function to a S3 bucket? 从 AWS Lambda function 调用授权的 Api 网关端点 - Call Authorized Api Gateway endpoint from AWS Lambda function 通过 AWS Gateway Api 通过 Lambda 将文件上传到 S3 - Upload file via AWS Gateway Api through Lambda to S3 使用 Lambda 和 API 网关上传到 S3 后文件损坏 - File corrupted after upload to S3 using Lambda and API Gateway 从AWS Lambda函数中的S3获取对象并发送到Api Gateway - Get object from S3 in AWS Lambda function and send to Api Gateway 使用API​​网关,AWS LAMBDA和S3从浏览器检索文件 - Retrieve a file from browser using API gateway, AWS LAMBDA and S3 如何将 CSV 文件从 api 端点发送到节点 js lambda 中的 S3 存储桶 - How to send CSV file from an api endpoint to S3 bucket in node js lambda AWS Lambda 仅使用 API 网关从 S3 访问 - AWS Lambda Access from S3 Only with API Gateway
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM