1개 답변
- 최신
- 최다 투표
- 가장 많은 댓글
0
Yes, presigned URL are working with public block access Buckets.
-
The easiest way to implement this is to create a frontend with an API gateway that call a lambda, calling S3API to generate a signed URL. this is valid both for upload and download.
-
if you don't want to use an API gateway you can have a front end web server,
This is an article that explain the entire process: generate presigned URL using API gateway and lambda if you need to download the file is something along these lines:
async function getDownloadUrl (file) {
const { key, versionId } = file
const params = {
Bucket: my-test-bucket,,
Key: 'myDoc/myfile.pdf', //the directory in S3
VersionId: versionId, //we use S3 versioning
Expires: 60
}
try {
const url = await new Promise((resolve, reject) => {
s3.getSignedUrl('getObject', params, function (err, url) {
if (err) {
reject(err)
}
resolve(url)
})
})
return url
} catch (err) {
logger.error('s3 getObject, get signedUrl failed')
throw err
}
}
답변함 4년 전
관련 콘텐츠
- 질문됨 7달 전