简体   繁体   English

将新的 object 上传到 S3 存储桶时,使用 Lambda 生成 presignedURL

[英]Generate presignedURL with Lambda when upload new object to S3 bucket

i searched everywhere but i cannot find a script which allows lambda to generate a presigned url when i upload a new object to an s3 bucket.我到处搜索,但找不到允许 lambda 在我将新的 object 上传到 s3 存储桶时生成预签名的 url 的脚本。 Thanks!谢谢!

I don't think you'll find an already-made solution online, but the following workflow should work:我认为您不会在网上找到现成的解决方案,但以下工作流程应该可行:

  • Catch the S3 upload event using S3 notifications and trigger a Lambda.使用S3 通知捕获 S3 上传事件并触发 Lambda。
  • Make the Lambda retrieve the name of the objects and creates a pre-signed URL.让 Lambda 检索对象的名称并创建一个预签名的 URL。
  • Upload this URL to a DynamoDB table (or anything else which fits your use-case. SSM Parameter Store for example).将此 URL 上传到 DynamoDB 表(或适合您的用例的任何其他内容。例如 SSM Parameter Store)。

Make sure your Lambda has all the correct rights, and pay attention to the fact S3 pre-signed URL generated with SDK have a expiration date of 7 days max .确保您的 Lambda 拥有所有正确的权利,并注意使用 SDK 生成的 S3 预签名 URL 的有效期最长为 7 天

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

相关问题 知道何时上传到 s3 存储桶完成 - Know when upload to s3 bucket is complete 使用 Api Gateway、Lambda 函数将图像上传到 S3 存储桶 - Upload Image into S3 bucket using Api Gateway, Lambda funnction 尝试使用 preSignedUrl 将图像上传到 aws s3 存储桶时出现 400 错误请求错误。 出了什么问题? - I am getting 400 bad request error while trying to upload image to aws s3 bucket using preSignedUrl. What is going wrong? 当 Amazon S3 删除正在进行并且上传试图覆盖同一存储桶中的相同 object 时会发生什么 - What happens when Amazon S3 deletion is in progress and upload is trying to overwrite same object in same bucket 使用 axios 将文件上传到 S3 存储桶时出现 403 - 403 when upload file to S3 bucket using axios 上传文件时收听 aws s3 bucket - Listen to aws s3 bucket when upload file 如何使用 lambda 和 PHP 将动态生成的文件上传到 S3 存储桶? - How to upload dynamically generated file to S3 bucket using lambda with PHP? object 更改存储时 AWS S3 存储桶通知 class? - AWS S3 Bucket Notifications when object changes storage class? 从 opencv 上传图片到 s3 bucket - Upload image from opencv to s3 bucket Nextjs - Autodesk Forge 上传到 S3 存储桶 - Nextjs - Autodesk Forge upload to S3 bucket
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM