Generate S3 Presigned URL with 7 Day Expiry via Lambda

0

Trying to find a way to generate a presigned URL via Lambda to get an S3 object. Need to be able to set the expiry for up to 10 days. I see that it is possible to do this via SDK using the signature v4 signing process, but don't believe that this can be done via Lambda. Is this possible?

profile pictureAWS
JD
질문됨 4년 전5499회 조회
2개 답변
1
수락된 답변

This can be accomplished using Lambda up to a maximum of 7 days. 10 days is beyond the maximum valid expiration period for any pre-signed url scenario using Sig V4. To have a pre-signed URL be valid for the entire 7 days you need to use valid credentials for an IAM User to generate the URL. To do this in Lamdba you'd need to give the Lambda access to long-lived IAM User credentials and and use them to generate the pre-signed URL w/ Sig v4.

You could do this with encrypted ENV Variables or Secrets Manager for example. Then configure your lambda to use these credentials, and not a the Lambda's execution role credentials when generating the pre-signed urls.

AWS
전문가
JDB
답변함 4년 전
profile picture
전문가
검토됨 4달 전
0

This is related to a topic located here: https://repost.aws/questions/QUN4e24VL5QM6ygP99mEydUA/generate-presigned-url-for-s-3-object-lambda.

To see an updated guide for how to build presigned URLs and set the expiration date, this guide is pretty helpful: https://howtocloud.io/generate-s3-presigned-urls-with-boto3/.

답변함 2년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠