使用移动凭据Aws S3 lambda上传

时间:2018-02-02 23:55:29

标签: amazon-s3 aws-lambda aws-api-gateway amazon-cognito

我有一个使用cognito为用户提供凭据的移动应用。

我希望用户使用相同的用户凭据上传到网络上的s3。

lambda和api网关可以实现吗?文件大小约为10MB。

这将是一个托管在s3上的静态网站,我有一个认证流程,可以获得他们的cognitoID。

或者是否有使用签名网址的其他方式?

1 个答案:

答案 0 :(得分:1)

Uploading to Lambda isn't a good idea. It has limited in payload size (up to 6mb) and also execution time (if your user is on a bad connection, it will timeout).

If you need to process something before allowing a user to upload, you can trigger Lambda, process whatever you want, generate a pre-signed S3 URL and pass it to the user, so that he can upload directly to S3.

In case you need to process something after the upload is finished, you can activate S3 streams and have a Lambda function auto-triggered any time someone uploads anything to a bucket.